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!

有帮助吗?

解决方案

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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top