1

I tried to search for solutions, but couldn't find any. Everywhere they are talking about Gridview within UpdatePanel. In my case I have an UpdatePanel within the EditItemTemplate of a Gridview and a DropDownList in that EditItemTemplate is causing postback on SelectChange event. I just want that cell or at most that row of the gridview to be partially rendered, but the whole page flashes.

I have used an update panel elsewhere on that page, but outside the gridview, and it is working fine.

Is UpdatePanel not supported within Gridview templates?

Thanks!

Aamir
  • 791
  • 3
  • 15
  • 28
  • What happens if you move the UpdatePanel outside and wrap the entire GridView? – Garrison Neely Jul 25 '13 at 18:40
  • I guess it will work, but I don't want to refresh the whole gridview if only one row is being updated. I may have to eventually do that if don't find any solution for the original problem. – Aamir Jul 25 '13 at 19:59

1 Answers1

3

You need to specify AsyncPostBackTrigger inside the <Triggers> element for the UpdatePanel . I tried same and it was working.

<asp:UpdatePanel ID="upSetSession" runat="server">
            <ContentTemplate>
                <asp:DropDownList ID="ddlMyList" runat="server" 
                    onselectedindexchanged="ddlMyList_SelectedIndexChanged"
                    AutoPostBack="true">
                    <asp:ListItem>One</asp:ListItem>
                    <asp:ListItem>Two</asp:ListItem>
                    <asp:ListItem>Three</asp:ListItem>
                </asp:DropDownList>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ddlMyList" 
                    EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
R.C
  • 10,417
  • 2
  • 35
  • 48
  • 1
    Thanks very much! That solved the problem. Since the DropdownList was within the UpdatePanel, it never occurred to me that it should also be setup as a truggers. I thought triggers were supposed to be outside the UpdatePanel. Any way this got the job done. It was causing error and not recognizing the EventName I provided, even though it was correct. I had to remove it and its working fine. No more full page flashes. – Aamir Jul 26 '13 at 13:22