DCSIMG
UpdatePanelExtender Upgrade - YsA.Net

UpdatePanelExtender Upgrade

Posted Friday, August 17, 2007 3:01 PM by ysa

In Updating an UpdatePanel in the Client side, I described how I solved the problem of updating an UpdatePanel from the client side. The solution was pretty simple : Create an extender which adds an hidden button to the update panel, and performs a click on it when the "update()" method is called from the JavaScript.

Recently I saw a new Webcast in the Asp.Net Ajax How Do I series which explains how to do this with and without the button. In short, the solution requires a call to a private method in the PageRequestManager which performs a post back :

var prm = Sys.WebForms.PageRequestManager.getInstance(); prm._doPostBack(updatePanelClientID,'');

So, I decided to upgrade the extender - Which now calls this method instead of adding a button and clicking on it. It makes the server and client code of the extender cleaner, and more simple.

Also I have fixed the issue of the OnUpdated event - which is now working perfectly : It is triggered when the "update()" method in the client is called. I caused the event to trigger by using properties from the ScriptManager :

ScriptManager currentScriptManager = ScriptManager.GetCurrent(Page); if ((currentScriptManager.IsInAsyncPostBack) && (currentScriptManager.AsyncPostBackSourceElementID == TargetUpdatePanel.ID)) { OnUpdated(new UpdatedEventArgs()); }

I simply check if the post back is Asynchronies and was caused by the update panel (the id I used when I called the _doPostBack method in the client).

Feel free to download and use my brand new UpdatePanelExtender!

I will be glad to read your comments,suggestions, bugs, etc...

Have a great weekend.

Comments

# YsA.Net : Updating an UpdatePanel in the Client side

Friday, August 17, 2007 3:10 PM by YsA.Net : Updating an UpdatePanel in the Client side

# re: UpdatePanelExtender Upgrade

Monday, March 17, 2008 3:33 PM by Pratik

I need this type of solution which is very good example for client side.

Thanks for Upload your update Version of your control.

Regards,

Pratik Mistry

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: