下拉列表不响应"OnSelectedIndexChanged".方法. [英] Dropdownlist not responding to the "OnSelectedIndexChanged" method.
问题描述
我的页面上有几个下拉列表.第一个按预期工作,并填充了其他两个的数据集,并将它们显示在屏幕上.
一旦从第二个和第三个下拉列表中进行选择,就会出现我的问题.似乎onSelectedIndexChanged方法未触发.....
I have several dropdownlists on my page. The first works as expected and populated the the datasets for the other two and displays them on the screen.
My issue arises once I make a selection from the 2nd and 3rd dropdownlists. It appears that the onSelectedIndexChanged method is not firing.....
<asp:Label ID="Label3" runat="server" Text="Study Selection"></asp:Label> <br /> <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" onSelectedIndexChanged="displayDefinitions" ><br /> </asp:DropDownList> <asp:Label <br /> ID="Label1" runat="server" Text="Row Selection" Visible="False"></asp:Label> <br /> <asp:DropDownList ID="DropDownList1" runat="server" Visible="false" onSelectedIndexChanged="nextStep" ><br /> </asp:DropDownList> <asp:Label <br /> ID="Label2" runat="server" Text="Column Selection" Visible="False"></asp:Label> <br /> <asp:DropDownList ID="DropDownList2" runat="server" Visible="false" onSelectedIndexChanged="nextStep" ><br /> </asp:DropDownList><br />
DropDownList3正常,
DropDownList1和DropDownList2无效.我可以进行选择,但是底层代码不会被调用.
我敢肯定这将是看似简单的事情,但我只是看不到它.
谢谢
DropDownList3 works fine.
DropDownList1 and DropDownList2 do not. I can make a selection, but the underlying code is not called.
I''m sure it''s going to be something deceptively simple, but I''m just not seeing it.
Thanks for any help offered.
推荐答案
将DropDownList1和DropDownList2的AutoPostBack设置为true,就像在DropDownList3中一样,如下所示
Set AutoPostBack true for DropDownList1 and DropDownList2 as you did in DropDownList3 as below
<br /><asp:DropDownList ID="DropDownList1" runat="server" Visible="false" AutoPostBack="True" onSelectedIndexChanged="nextStep" ></asp:DropDownList><br /><br /><asp:DropDownList ID="DropDownList2" runat="server" Visible="false" AutoPostBack="True" onSelectedIndexChanged="nextStep" ></asp:DropDownList><br /><br />
这篇关于下拉列表不响应"OnSelectedIndexChanged".方法.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!