如何让一个DropDownList绑定值后默认值为空,设置默认选中值

2025-05-20 03:50:34
推荐回答(1个)
回答1:

1.
ListItem wxlx_item = wxlx.Items.FindByValue(sdr.GetValue(10).ToString().Trim());
if (wxlx_item != null)
{
wxlx_item.Selected = true;
}
2.
DropDownList1.SelectedIndex = this.DropDownList1.Items.Count - 1;