日期:2014-05-17  浏览次数:20457 次

DropDownList只有一项的时候,怎么触发SelectedIndexChanged事件?
我的下拉列表框里,就一个值,怎么触发SelectedIndexChanged事件?

还有,下拉列表框的数据加载的时候,能触发SelectedIndexChanged事件吗?

比如:
DropDownList.DataTextField="field1"
DropDownList.DataValueField="field2"
DropDownList.DataSource=datatable1
DropDownList.DataBind()
DropDownList.SelectedIndex=0

这里把数据绑定到了DropDownList上,设置初始选择第0项,这个时候怎么触发SelectedIndexChanged事件?

点击DropDownList,在下拉列表里选择另一项的时候,当然会触发SelectedIndexChanged事件?
但是如果下拉列表里就只有一项,没第二项可以换,怎么触发SelectedIndexChanged事件呢?

------解决方案--------------------
引用:
我的下拉列表框里,就一个值,怎么触发SelectedIndexChanged事件?

还有,下拉列表框的数据加载的时候,能触发SelectedIndexChanged事件吗?

比如:
DropDownList.DataTextField="field1"
DropDownList.DataValueField="field2"
DropDownList.DataSource=dat……

这种变态的需求?
一项还用啥dropdownlist 用button.

page_load
+= new EventHandler(_Click);