NET AJAX 入门系列 :在多个UpdatePanle 中使用Timer 控件 本文将使用Timer控件更新两个UpdatePanel控件,Timer控件将放在UpdatePanel控件的外面,并将它配置为UpdatePanel的触发器,翻译自官方文档
主要内容 在多个UpdatePanel中使用Timer控件 1.添加一个新页面并切换到设计视图
2.如果页面没有包含 ScriptManager控件,在工具箱中的AJAX Extensions标签下双击ScriptManager控件添加到页面中
3.双击 Timer控件添加到 Web页面中
Timer控件可以作为UpdatePanel的触发器不管它是否在UpdatePanel中
4.双击UpdatePanel控件添加一个Panel到页面中,并设置它的UpdateMode属性值为Conditional
5.再次双击UpdatePanel控件添加第二个Panel到页面中,并设置它的UpdateMode属性值为Conditional
6.在UpdatePanel1中单击,并在工具箱中Standard标签下双击Label控件添加到UpdatePanel1中
7.设置Label控件的Text属性值为“UpdatePanel1 not refreshed yet”
8.添加Label控件到UpdatePanel2
9.设置第二个 Label控件的Text属性值为“UpdatePanel2 not refreshed yet”
10.设置Interval属性为10000
Interval属性的单位是毫秒,所以我们设置为10000,相当于 10秒钟刷新一次
11.双击 Timer控件添加 Tick事件处理,在事件处理中设置Label1和 Label2的 Text属性值,代码如下
public partia