Call a Javascript Function after UpdatePanel Postback Issue Call a Javascript Function after UpdatePanel Postback Issue ajax ajax

Call a Javascript Function after UpdatePanel Postback Issue


you can add the following code in Page_Load event:

ScriptManager.RegisterStartupScript(Me.rptGridAlbum, rptGridAlbum.GetType, "scriptname", "somejavascript", True)

This will fire the javascript on your page after the AJAX callback.

MSDN


You could create a simple webservice method that returns the javascript array to the page whenever required and wrap the call to that webservice in a javascript method. Invoking the javascript method to refresh the array in memory on the browser side will work better than expecting the js array literal to be parsed again on UpdatePanel postbacks with any success.


var prm = Sys.WebForms.PageRequestManager.getInstance();if (prm != null) {    prm.add_endRequest(function (sender, e) {        if (sender._postBackSettings.panelsToUpdate != null) {            DisplayCurrentTime(); // here your javascript function        }    });};