ASP.NET 刷新更新面板

发布于 2024-07-08 00:13:24 字数 94 浏览 4 评论 0原文

我在更新面板内有一个 ListView,想要从按钮单击事件触发的代码后面更改选择查询,然后重新加载更新面板内的 ListView。 有谁知道如何使更新面板从后面的代码刷新?

I have a ListView inside of an Update Panel and wanted to change the Select Query from the code behind fired by a button click event and then reload the ListView inside of the Update Panel. Does anyone know how to cause the Update Panel to refresh from the code behind?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

两人的回忆 2024-07-15 00:13:24

只需执行以下操作:

YourUpdatePanelId.Update();

来自 MSDN

如果页面启用了部分页面呈现,则当您调用 Update 方法时,UpdatePanel 控件的内容将在浏览器中更新。 如果您有必须执行以确定是否应更新 UpdatePanel 控件的服务器代码,请调用 Update 方法。 如果您计划使用 Update 方法,请将 UpdateMode 属性设置为 Conditional。 如果您希望在服务器逻辑中确定更新面板的决定,请确保 ChildrenAsTriggers 属性为 false,并且没有为面板定义显式触发器。

在典型的页面开发场景中,如果定义触发器或者 UpdatePanel 控件的 ChildrenAsTriggers 属性为 true,则在页面生命周期中会自动调用 Update 方法。

如果没有为 UpdatePanel 控件定义 ContentTemplate 属性,则不会发生面板更新。

Just do:

YourUpdatePanelId.Update();

From MSDN:

If the page is enabled for partial-page rendering, when you invoke the Update method, the UpdatePanel control's content is updated in the browser. Call the Update method if you have server code that must execute to determine whether an UpdatePanel control should be updated. If you plan to use the Update method, set the UpdateMode property to Conditional. If you want the decision to update the panel to be determined in server logic, make sure that the ChildrenAsTriggers property is false and that no explicit triggers are defined for the panel.

In a typical page development scenario, if you define triggers or if the ChildrenAsTriggers property is true for the UpdatePanel control, the Update method is automatically called during the page life cycle.

If the ContentTemplate property is not defined for the UpdatePanel control, no updates of the panel will occur.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文