Thursday, July 05, 2012

ScriptManager.RegisterDataItem Method (Control, String)

How can you update a control which resides outside the update panel in an asynchronous post back?

You can use ScriptManager.RegisterDataItem to send data from the server to client whether the response control is inside the update panel or not. RegisterDataItem method can be called only during an asynchronous postbacks. The data item which is registered with the RegisterDataItem method can be accessed through the client script in  pageLoading, pageLoaded, and endRequest events of the PageRequestManager object. When you handle the event, custom data is passed in an event argument object. If you have a handler for pageLoaded event, customer data is passed in the PageLoadedEventArgs class which exposed dataitems property.

No comments:

Post a Comment