Force update of an ASP.NET AJAX UpdatePanel using JavaScript

by Vladimir Enchev | Comments 2
Since the beginning of ASP.NET AJAX era I have seen very few examples on how to manually force update of an ASP.NET AJAX UpdatePanel using JavaScript and I have decided to post very simple approach how to do this.

First of all you will need to create your own UpdatePanel which will inherit from the original ASP.NET AJAX UpdatePanel and will implement IPostBackEventHandler interface:



Now you can call explicitly Update() method of the UpdatePanel:



... and that's it! :-) ... however we can extend this control with an event which will be raised on explicit updates:


Now you can use the new UpdatePanel in your pages like this:





Enjoy!

,
Senior Technical Architect

2 Comments

Remco Ros
thanks for sharing, great example!

Comments

  1.    
      
      
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)
Read more articles by Vladimir Enchev - or - read latest articles in Developer Tools