如何自动刷新ASP.NET GridView [英] How to refresh an ASP.NET GridView automatically
本文介绍了如何自动刷新ASP.NET GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨我有一个有500多条记录的网格,网格中的数据值每5分钟更新一次......我需要每隔5分钟自动刷新网格
代码使用:
< asp:UpdatePanel ID = UpdatePanel1 runat = 服务器 >
< ContentTemplate >
< asp:Timer ID = Timer1 runat = server 时间间隔 = 3600 ontick = Timer1_Tick > < / asp:Timer >
< asp:GridView ID =GridView2
runat = server AutoGenerateColumns = False DataKeyNames = CustomerID
DataSourceID = SqlDataSource1 AllowPaging = True AllowSorting = True >
代码落后:
受保护 void Timer1_Tick( object sender,EventArgs e)
{
GridView2.DataBind();
}
但它不起作用请帮帮我...
解决方案
这里:
使用UpdatePanel和Timer控件:如何定期自动刷新ASP.NET GridView [ ^ ]
使用jQuery AJAX:如何制作像Gmail收件箱一样的GridView自动部分更新 [ ^ ]
您可以使用icallback,也可以使用Web服务调用来刷新网格。使用javascript计时器每5分钟调用一次(web服务或icallback)...
使用SignalR ---服务器通知客户端它必须刷新数据
Hi i have a grid with 500+ records and the data values in the grid are updated every 5min...I need to "AUTO refresh " the grid for every 5 mins
Code am using:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="3600" ontick="Timer1_Tick"></asp:Timer>
<asp:GridView ID="GridView2
" runat="server" AutoGenerateColumns="False" DataKeyNames="CustomerID"
DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True">
Code behind:
protected void Timer1_Tick(object sender, EventArgs e)
{
GridView2.DataBind();
}
But it is not working please help me ...
解决方案
Here:
Using UpdatePanel and Timer control: How to refresh an ASP.NET GridView automatically at regular intervals[^]
Using jQuery AJAX: How to Make GridView Auto Partial Update like Gmail Inbox[^]
you can either use a icallback or you can use a web service call to refresh the grid . use javascript timer to call this( either web service or icallback) at every 5 minutes...
Use SignalR --- the server notifies the client that it has to refresh the data
这篇关于如何自动刷新ASP.NET GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文