views:

835

answers:

3

How can we refresh a web user control automatically without a page postback in asp.net 2.0? i have tried meta tags in controls head tag but it also refreshes the whole page.

A: 

User Controls are server based controls. Your only option might be some type of javascript but depending on what you are try to accomplish, unlikely.

Andrew Robinson
+2  A: 

You could try implementing a little bit of the ASP.NET AJAX Framework into your app and wrapping that control in an UpdatePanel. It will work with .NET 2.0

Edit: Here is a quick link to a tutorial on using the ASP.NET AJAX UpdatePanel: http://ajax.net-tutorials.com/controls/updatepanel-control/

And here is the official introduction page from the ASP.NET website: http://www.asp.net/Ajax/Documentation/Live/tutorials/IntroductionUpdatePanel.aspx

TheTXI
A: 

There are several ways to do it and it depends on what your control is made of.

One of the easiest ways to do it is to wrap the control in an UpdatePanel and then use a Timer control to just update that UpdatePanel. But that might be expensive in terms of viewstate.

Another option is to use something like Jquery and a Javascript timer to count down and then refresh using static page Methods (http://encosia.com has examples).

Jared