how to reload the usercontrol in the master page with effecting other part of the master page
I have a master page. In that master page i have a user control which holds a Label control, it shows data read from a text file using marquee. My text file changes every 2 minute开发者_StackOverflow中文版s so I want to reload my user control every 2 minutes without effecting the master page.
How can i do that?
Any help is appreciated.
You could put the user control in an UpdatePanel and refresh the contents via an AsyncPostBack trigger as described in the following article:
http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-updatepanel-triggers
Here is one sluggish solution:
put the label
control in a new page (with no master page) and add a timer
with that label to refresh every 1 minute or so.
Now, go back to your master page and add an iframe
with SRC
pointing to the new page you created before. This way, all the refresh effect will be limited to the iframe only and not to your master page.
*Edit: you don't need a timer for the page inside the iframe. Just set the META refresh time period to whatever you want and in the code behind of that page, let the Page_Load event populate the label
UpdatePanel and use a Timer.
http://msdn.microsoft.com/en-us/library/cc295400.aspx
精彩评论