默认选择的文本为“选择”在下拉组合框中 [英] Default Selected text as a "Select" in drop down combo box
本文介绍了默认选择的文本为“选择”在下拉组合框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我想将我的组合框默认选中值设为选择文字,有没有属性?
Plzz帮助。
Thanx提前
解决方案
ListItem newItem = new ListItem();
newItem.Text =Select;
newItem.Value =0;
DropDownName.Items.Add(newItem);
你必须将第一个选项设置为正在选择例如:
< select id = myDropDown >
< 选项 > 选择水果.... < / option >
< 选项 > Apple < / option >
< 选项 > Banana < / option >
< 选项 > Pear < / option >
< / select >
在页面加载中尝试此操作,但仅限于Ispostback
是false
:
dropdown1.Items.Insert( 0 , new ListItem( - 选择 - , 0跨度>));
Hi
I want to set my combo box default selected value as "Select" text ,is there are any property ??
Plzz help.
Thanx in advance
解决方案
ListItem newItem = new ListItem();
newItem.Text = "Select";
newItem.Value = "0";
DropDownName.Items.Add(newItem);
You have to set the 1st option as being "Select" eg:
<select id="myDropDown"> <option>Select a fruit....</option> <option>Apple</option> <option>Banana</option> <option>Pear</option> </select>
Try this in your page load but only whenIspostback
isfalse
:
dropdown1.Items.Insert(0, new ListItem("--Select--", "0"));
这篇关于默认选择的文本为“选择”在下拉组合框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文