I) just started to learn C #, some basic controls do not know enough, there is a real-time monitoring system, need to refresh the data on the page every 5 seconds,
If every 5 seconds page all refresh, that page can not see at all, to this question in CSDN also specially opened a post, asked everyone master,
Posts: http://topic.csdn.net/u/20100109/23/812355fb-32ce-4e3b-98ec-be80c630e1d5.html
II) The basic idea of realization:
With Microsoft Ajax easy to achieve!!
1. Drag into the ScriptManager;
2. Drag into UpdatePanel
3. Add a timer timer, set INTERVQL to 5 seconds (5000)
4. Add a Data control, depending on the needs of the GridView or DataList, etc., connect the database
5. Set UpdatePanel to conditional asynchronous update
6. Enter the code in the timer's tick event
protected void Timer1_Tick (object sender, EventArgs e)
{
Updatepanel1.update ();
Gridview1.databind ();//If the display data is a GridView
}
III) Specific implementations:
<asp:scriptmanager id= "ScriptManager1" runat= "Server" > </asp:ScriptManager> <asp: UpdatePanel id= "UpdatePanel1" runat= "Server" > <ContentTemplate> <%= DateTime.Now.ToString ()% > <!--the GridView control is bound in the background---> <asp:gridview id= "GridView1" runat= "Server" > </asp: Gridview> <!--timer refreshes the data in UpdatePanel once every 5 seconds-- <asp:timer id= "Timer1" runat= "Server" interval= " "> </asp:Timer> </ContentTemplate> <Triggers> <asp: Asyncpostbacktrigger controlid= "Timer1" eventname= "Tick" ></asp:AsyncPostBackTrigger> </triggers > </asp:UpdatePanel>
C # Real-time Read Data----Local page refresh "Go"