I) Now I am just learning C #. I don't know enough about some basic controls. I have a real-time monitoring system that needs to refresh the data on the page every five seconds,
If you refresh all the pages every five seconds, you will not be able to read the page at all. You have posted a special post on csdn and asked the experts,
Post: http://topic.csdn.net/u/20100109/23/812355fb-32ce-4e3b-98ec-be80c630e1d5.html
Ii) basic implementation ideas:
It can be easily implemented using Microsoft's Ajax !!
1. Drag the scriptmanager file;
2. Drag the updatepanel
3. Add a timer.
Timer, set intervql to 5 seconds (5000)
4. Add a Data Control and connect to the database based on the needs of the gridview or datalist.
5.
Set updatepanel to conditional asynchronous update
6. input the code in the tick event of timer.
Protected void
Timereffectick (Object sender, eventargs E)
{
Updatepanel1.update ();
Gridview1.databind (); // If the displayed data is a gridview
}
Iii) specific implementation:
<Asp: scriptmanager id = "scriptmanager1" runat = "server"> <br/> </ASP: scriptmanager> <br/> <asp: updatepanel id = "updatepanel1" runat = "server"> <br/> <contenttemplate> <br/> <% = datetime. now. tostring () %> <br/> <! -- The gridview control is bound in the background ---> <br/> <asp: gridview id = "gridview1" runat = "server"> <br/> </ASP: gridview> <br/> <! -- The timer refreshes the data in updatepanel every 5 seconds --> <br/> <asp: timer id = "timer1" runat = "server" interval = "5000"> <br/> </ASP: timer> <br/> </contenttemplate> <br/> <triggers> <br/> <asp: asyncpostbacktrigger controlid = "timer1" eventname = "tick"> </ASP: asyncpostbacktrigger> <br/> </triggers> <br/> </ASP: updatepanel>