Monday, September 19, 2011

Script to update updatepanel

How to force updatepanel to refresh?

 __doPostBack()

There’s an easy method for triggering a postback targeted at the UpdatePanel: __doPostBack().
As long as the event target of a __doPostBack() call is an async trigger of an UpdatePanel, the ASP.NET AJAX framework will intercept the postback and fire a partial postback instead.

Example below.
<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
 
Now, clicking anywhere in the UpdatePanel will trigger a partial postback, targeting the UpdatePanel.

No comments:

Post a Comment