.net - 自定义服务器控制导致 UpdatePanel 内的完整回发

标签 .net asynchronous updatepanel postback custom-server-controls

我有一个自定义服务器控件,在我将它放入 UpdatePanel 之前,它似乎可以正常工作。一旦进入 UpdatePanel,它会继续正常工作,但是当我的自定义服务器控件执行回发时,UpdatePanel 现在会执行完整的回发。

我是否需要做任何事情才能使我的自定义服务器控件在 UpdatePanel 内执行异步回发?

这是导致完整回发的相关代码。 ecs:Pager 控件是我的自定义控件,即使它在 UpdatePanel 中,它也会导致 OnCommand 事件的完整回发。

<asp:UpdatePanel ID="ClosedIssuesUpdatePanel" runat="server">
    <ContentTemplate>
        <ecs:Pager ID="ClosedIssuesPager" OnCommand="ClosedIssuesPager_Command" runat="server" />
        <asp:Repeater ID="ClosedIssuesRepeater" runat="server">
        ....
        </asp:Repeater>
    </ContentTemplate>
</asp:UpdatePanel>

最佳答案

将更新面板的更新模式设置为有条件的。

<asp:UpdatePanel ID="ClosedIssuesUpdatePanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <ecs:Pager ID="ClosedIssuesPager" OnCommand="ClosedIssuesPager_Command" runat="server" />
        <asp:Repeater ID="ClosedIssuesRepeater" runat="server">
        ....
        </asp:Repeater>
    </ContentTemplate>
</asp:UpdatePanel>

关于.net - 自定义服务器控制导致 UpdatePanel 内的完整回发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/941606/

相关文章:

c# - 根据可变数量的空格拆分字符串

.net - 在新机器上部署 .net 应用程序并获得 "The system cannot execute the specified program"

javascript - NodeJS 在继续之前检查功能是否完成

当将 Javascript 函数放在母版页上时,它不会从后面的代码中调用

c# - Internet Explorer 无法打开网站

c# - UpdatePanel 停止 Javascript 工作

c# - 覆盖 Json.Net 中的默认基元类型处理

c# - .NET 3.5 (C#) 应用程序无法在 Windows XP Professional 上运行

c++ - 如何从 C++ 异步(最好是并行)获取 Windows 上的文件图标?

javascript - NodeJS 和 Neo4j 的异步行为问题