gridview的频繁更新 [英] gridview that is updated frequently
问题描述
我有一个 ASP.NET
GridView控件
显示从数据库中某些条目。条目需要非常频繁地更新(如果在数据库上发生的变形例,但是应当在asp.net网站内至多3秒反射的)。
I have a ASP.NET
gridview
that shows some entries from the database. The entries need to be updated very frequently (if a modification occurs on the database, it should be reflected in the asp.net website within at most 3seconds).
我在想解决的办法是把 GridView控件
更新面板内,并刷新页面每隔3秒。有没有更好的选择?
The solution I am thinking about is to put the gridview
inside an update panel and refresh the page every 3 seconds. Is there a better alternative?
推荐答案
通过在更新面板使用定时器U可以执行更新operation.For例子..
By using Timer in the update panel u can perform that update operation.For example ..
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="10000">
</asp:Timer>
</div>
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="UpdatePanel1 not refreshed yet."></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="UpdatePanel2 not refreshed yet."></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</form>
而不是标签控制ü可以使用GridView的。
instead of label control u can use gridview.
这篇关于gridview的频繁更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!