An event bound to a DropDownList in a standalone GridView obviously would work in this fashion , but things are bit more complicated in this scenario.
The event does not fire for the DropDownList. What's interesting is the event bound to the Button Does fire. Not sure what the difference would be between the DropDownList and TextBox.
I've tried both OnSelectedIndexChanged and OnTextChanged - neither work.
The nesting is as follows:
- GridView A
- Ajax Accordion
GridView B (With DropDownList)
<AjaxToolkit:AccordionPane ID="AccordionPane1" runat="server"> <Header> </Header> <Content> <asp:GridView runat="server" ID="gv" AutoGenerateColumns="false" BorderWidth="0" AlternatingRowStyle-BorderStyle="None" ShowFooter="true"> <Columns> <asp:TemplateField HeaderText="Id"> <ItemTemplate> <asp:Label runat="server" ID="lblId" Text='<%# Eval("Id") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Type"> <ItemTemplate> <asp:Label runat="server" ID="lblType"></asp:Label> </ItemTemplate> <FooterTemplate> <asp:DropDownList runat="server" ID="ddlType" OnTextChanged="ddlType_SelectedIndexChanged" AutoPostBack="true"> </asp:DropDownList> <asp:Button runat="server" ID="btnTest" OnClick="btnTest_Click" Text="TEST" /> </FooterTemplate> </asp:TemplateField> </Columns> </asp:GridView> </Content>
Thank you!
UPDATE
Turns out this had nothing to do with the nested GridViews or Accordion.
After adding the following, the event now successfully fires:
if (!Page.IsPostBack)
Populate(object);