如何在一段时间后触发我的更新面板刷新。
答案 0 :(得分:4)
您可以使用ASP.NET AJAX Timer控件在一段时间后触发事件。 从ASP.NET官方网站查看此视频,了解如何使用Timer: http://www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-timer-control
答案 1 :(得分:2)
使用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的链接不再有效,请使用this MSDN article。
答案 2 :(得分:1)
使用ID“btnRefresh”为页面添加一个按钮。
将按钮设置为更新面板上的触发器。
添加以下Javascript:
function RefreshUpdatePanel() {
__doPostBack('<%= btnRefresh.ClientID %>','');
}
setTimeout('RefreshUpdatePanel()', 10000);
setTimeout函数将每10秒调用一次RefreshUpdatePanel()函数。 RefreshUpdatePanel