if (listvalue==name.Trim())
{
kehulist.SelectedIndex=itemid;
}
通过DropDownList控件的SelectedIndex属性设置其选择项的索引
索引从0开始
name="3 "
name.Trim()
通过Trim函数将字符串左右的空格去掉
本文介绍了一种使用DropDownList控件的方法,通过设置SelectedIndex属性来选定特定项。示例中利用name变量经过Trim处理去除空白字符后,与listvalue进行比较,若两者相等,则设置kehulist控件的SelectedIndex为对应itemid。
if (listvalue==name.Trim())
{
kehulist.SelectedIndex=itemid;
}
通过DropDownList控件的SelectedIndex属性设置其选择项的索引
索引从0开始
name="3 "
name.Trim()
通过Trim函数将字符串左右的空格去掉
2万+

被折叠的 条评论
为什么被折叠?