开发者

DataGrid in an UpdatePanel doing full Refresh when clicking on column headers

I have a DataGrid on an asp.net webforms page in an unconditional UpdatePanel: <asp:UpdatePanel ID="upData" runat="server"> .

DataBinding occurs inside protected override void OnLoadComplete(EventArgs e) , as I process any user events before performing the binding. Clicking on the headers works proper开发者_开发知识库ly (i.e., triggers a sort), but causes a full page refresh rather than refreshing just the UpdatePanel.

I did find a way to fix this, but it's pretty horrifying (dgGrid being the DataGrid):

foreach (Control c in dgGrid.Controls[0].Controls[1].Controls)
{
    ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(c.Controls[0]);
}

Can anyone suggest a cleaner way to fix this?


add the following as a trigger to your UpdatePanel

            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="dgGrid" />
            </Triggers>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜