I am trying to get a DropDownList for AutoPostBack via UpdatePanel when the selected item is changed. I am a little embarrassed why this is not working.
Does anyone have any quick ideas?
ASPX page:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true" > <ContentTemplate> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>item 1</asp:ListItem> <asp:ListItem>item 2</asp:ListItem> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel>
Code-behind (I set a breakpoint on the line assignment to capture the postback):
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { string s = ""; }
Edit:
OK, now I'm working. Very strange. All that is needed is a reboot of Visual Studio. This is what scares me as a developer;) I think I’ve seen something like this before where VS is “out of sync” with the build.
FYI I am running VS 2008 Web Developer Express.
Thanks to those who answered.
source share