ASP.NET dropdownlist callback doesn't work inside div
Posted
by Wayne Werner
on Stack Overflow
See other posts from Stack Overflow
or by Wayne Werner
Published on 2010-05-25T13:36:37Z
Indexed on
2010/05/25
13:41 UTC
Read the original article
Hit count: 303
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!
© Stack Overflow or respective owner