设置“选择” HTML控件的选定值 [英] Set selected value of a 'Select' HTML control
本文介绍了设置“选择” HTML控件的选定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用ASP.NET和C#从代码隐藏文件中设置 Select
HTML控件的选定值?
How can I set the selected value of a Select
HTML control from a code-behind file using ASP.NET and C#?
推荐答案
有 FindByText
和 FindByValue
函数可用:
ListItem li = Select1.Items.FindByText("Three");
ListItem li = Select1.Items.FindByValue("3");
li.Selected = true;
这篇关于设置“选择” HTML控件的选定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文