I'm using VS2010/C# to develop my asp.net web app (a web telemetry site), my users enter their username/password and can view their defined plan (which contains some numbers obtained from db), I have created an app always active in background (on my server), this app checks a URL and reads some SMS messages, then stores them in DB (the URL is checked periodically each 2 minutes), I want my plan pages to be updated periodically (for instance each 2 minute), without user interaction, so that if any new data is arrived in DB, user can view it.
How can I periodiclly update my ASP.NET page? javascript? is there any samples? is there any way of smooth updating? i.e. how can I ajaxify my code? please note that I've used AJAX control panel, it works great but here I don't know how to ajaxify my code, in fact there is nothing in ASPX page, so I cannot create an update panel, I've done everything in codebehind.
something like this:
pageload( )
{
updatetable();
}
updatetable ()
{
select * from tblControl
label L = new label();
L.text = "something";
//...
Image img = new Image()
img.source = "something";
this.controls.add(L);//programatically add on the fly created controls to the page
this.controls.add(img);
}
now how can I ajaxify these controls? what are my options?
thanks
I think you're looking for the AJAX Timer Control.
If you couple it with the UpdatePanel , your users won't even see the page-flashing (using MaintainScrollPositionOnPostback as necessary)
Additionally, I noticed you create controls on the fly (dynamically) as the updates happen. Why not simply use a data control such as a Repeater or GridView, since your data is being stored in the database each time anyways, and let the controls do the heavy lifting themselves?