ASP.NET dropdownlist callback doesn't work inside div
- by Wayne Werner
This seems super weird to me. I have a callback handler done in VB which works fine with this code:
<!-- Div Outside Form -->
<div class="container">
<form id="querydata" runat="server">
<asp:DropDownList runat="server" ID="myddl" AutoPostBack="true" OnSelectedIndexChanged="myddlhandler">
<asp:ListItem>Hello</asp:ListItem>
<asp:ListItem>Goodbye</asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" ID="label1"></asp:Label>
</form>
</div>
<!-- Yep, they're matching -->
I can change the value and everything is A-OK, but if I change the code to this (div inside form):
<form id="querydata" runat="server">
<!-- Div inside form doesn't work :( -->
<div class="container">
<asp:DropDownList runat="server" ID="myddl" AutoPostBack="true" OnSelectedIndexChanged="myddlhandler">
<asp:ListItem>Hello</asp:ListItem>
<asp:ListItem>Goodbye</asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" ID="label1"></asp:Label>
</div>
</form>
It the postback no longer works. Is how asp is supposed to work? Or is it some magic error that only works for me? And most importantly, if asp is not supposed to work this way, how should I be doing this?
Thanks!