[英]refresh update panel at certain interval
如何在一段时间后触发我的更新面板刷新。
You can use ASP.NET AJAX Timer control in order to fire an event after a certain period of time. 您可以使用ASP.NET AJAX Timer控件在一段时间后触发事件。 Checkout this video from ASP.NET official website to find out how to use Timer: http://www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-timer-control
从ASP.NET官方网站查看此视频,了解如何使用Timer: http : //www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-timer-control
Use an ASP.Net-Ajax Timer to trigger the UpdatePanel: 使用ASP.Net-Ajax Timer来触发UpdatePanel:
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%--Typical GridView--%>
<asp:GridView
ID="gvOperations" runat="server"
GridLines="None" Width="100%"
AllowSorting="true" DataSourceID="odsOperations"
OnRowDataBound="GvOperations_RowDataBound">
<AlternatingRowStyle BackColor="aliceBlue" />
<HeaderStyle HorizontalAlign="Left" />
</asp:GridView>
<%--The Timer that causes the partial postback--%>
<asp:Timer runat="server" Interval="1500" OnTick="Timer_Tick" />
</ContentTemplate>
</asp:UpdatePanel>
http://mattberseth.com/blog/2007/08/using_the_ajax_timer_control_a.html http://mattberseth.com/blog/2007/08/using_the_ajax_timer_control_a.html
Update : Since Matt's link doesn't work anymore, use this MSDN article . 更新 :由于Matt的链接不再起作用,请使用此MSDN文章 。
Add a button to your page with the ID "btnRefresh". 使用ID“btnRefresh”向页面添加一个按钮。
Set the button to act as a trigger on the Update Panel. 将按钮设置为更新面板上的触发器。
Add the following Javascript: 添加以下Javascript:
function RefreshUpdatePanel() {
__doPostBack('<%= btnRefresh.ClientID %>','');
}
setTimeout('RefreshUpdatePanel()', 10000);
The setTimeout function will call the RefreshUpdatePanel() function every 10 seconds. setTimeout函数将每10秒调用一次RefreshUpdatePanel()函数。 The RefreshUpdatePanel
RefreshUpdatePanel
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.