UpdatePanel 内的 GridView PAGING 不适用于第二页更改,为什么?

问题描述 投票:0回答:1
c# asp.net gridview pagination updatepanel
1个回答
3
投票

将 UpdatePanel 声明更改为如下所示:

<asp:UpdatePanel ID="upAnswers" runat="server" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="gvAnswers" EventName="PageIndexChanging" />

每当我遇到这些

UpdatePanel
的问题时,我发现明确声明触发器会很有帮助。 特别是当您使用“非默认”事件触发 AsyncPostBack 时(SelectedIndexChanged 是 GridView 的“默认”事件)。

此外,ChildrenAsTriggers 默认为 true,因此我从标记中删除了它。

© www.soinside.com 2019 - 2024. All rights reserved.