C # Real-time Data Reading-partial page refresh

Source: Internet
Author: User

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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.