ASP.NET刷新更新面板 [英] ASP.NET refresh Update Panel

查看:54
本文介绍了ASP.NET刷新更新面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在更新面板中有一个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?

推荐答案

只需:

YourUpdatePanelId.Update();

来自 MSDN :

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

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.

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

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.

如果未为UpdatePanel控件定义ContentTemplate属性,则不会进行面板更新.

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

这篇关于ASP.NET刷新更新面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆