下拉列表的"SelectedIndexChanged"事件未触发 [英] Dropdownlist`s "SelectedIndexChanged" event is not firing
本文介绍了下拉列表的"SelectedIndexChanged"事件未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不会在运行时绑定数据的Dropdownlist的"SelectedIndexChanged"事件.
请解释一下可能是什么原因,并给我建议.
谢谢
K Uday
Hi,
"SelectedIndexChanged" event of Dropdownlist is not fired for which data is binded at runtime.
Please explain me what may be the reason, and advise me.
Thanks
K Uday
推荐答案
将该下拉列表的AutoPostBack
property设置为true
Set AutoPostBack
property to true for that dropdownlist
将下拉列表的数据绑定方法放入!Postback条件中
例如:
put the databinding method of dropdown inside !Postback condition
for ex:
Page_Load()
{
if(!IsPostBack)
{
BindDropDown();
}
}
private void BindDropDown()
{
//Write the databinding logic
}
还要使下拉菜单的autopostback属性为true.
Also make autopostback property true for dropdown.
设置AutoPostBack="true"
.
<asp:DropDownList ID="asp:DropDownList1" AutoPostBack="true" runat="server" </asp:DropDownList>
这篇关于下拉列表的"SelectedIndexChanged"事件未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文