[英]refresh update panel at certain interval
如何在一段時間后觸發我的更新面板刷新。
您可以使用ASP.NET AJAX Timer控件在一段時間后觸發事件。 從ASP.NET官方網站查看此視頻,了解如何使用Timer: http : //www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-timer-control
使用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
更新 :由於Matt的鏈接不再起作用,請使用此MSDN文章 。
使用ID“btnRefresh”向頁面添加一個按鈕。
將按鈕設置為更新面板上的觸發器。
添加以下Javascript:
function RefreshUpdatePanel() {
__doPostBack('<%= btnRefresh.ClientID %>','');
}
setTimeout('RefreshUpdatePanel()', 10000);
setTimeout函數將每10秒調用一次RefreshUpdatePanel()函數。 RefreshUpdatePanel
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.