ASP.NET
gridview
データベースからのいくつかのエントリを示す があります。エントリは非常に頻繁に更新する必要があります (データベースで変更が発生した場合、最大 3 秒以内に asp.net Web サイトに反映される必要があります)。
私が考えている解決策はgridview
、更新パネルの内側に配置し、3 秒ごとにページを更新することです。より良い代替手段はありますか?
更新パネルでタイマーを使用すると、その更新操作を実行できます。たとえば..
<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>
ラベル コントロールの代わりに、グリッドビューを使用できます。