1

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:

  1. GridView A
  2. Ajax Accordion
  3. 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);
gleichdanke
  • 171
  • 2
  • 12
  • Please look at your code. I fixed the `` portion from being hidden on here, and you've overwritten my fix =) All code needs to be indented by at least 4 spaces. – Josh Darnell Apr 09 '12 at 15:12
  • Thanks, I've corrected the code. – gleichdanke Apr 09 '12 at 15:16
  • No problem =) Also, check out [this solution](http://stackoverflow.com/a/636141/). It certainly sounds similar. – Josh Darnell Apr 09 '12 at 15:22
  • That did the trick. Turns out it had nothing to do with the nesting of GridViews/Accordian - it was an oversight of a classic problem. I'll post a resolved follow up. Thanks for your help! – gleichdanke Apr 09 '12 at 15:29
  • Great! Glad I could help. You should really post that solution as an answer to your own question, then check the checkmark box next to it. That way, future visitors will know how you solved this problem =) Good luck to you! – Josh Darnell Apr 09 '12 at 15:34
  • I will. I tried to but it mentioned something about how new members may not answer their own question within 8 hours of posting it. – gleichdanke Apr 09 '12 at 15:51
  • Ha, indeed I forgot about that. Well, if you think about it tomorrow, come back and post the answer. – Josh Darnell Apr 09 '12 at 16:02

1 Answers1

0

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(obj);
gleichdanke
  • 171
  • 2
  • 12