How to execute javascript once an update panel refreshes (Can't get Sys.WebForms.PageRequestManager.getInstance().add_endRequest(); to work)

≡放荡痞女 提交于 2019-12-05 11:49:41

Everything needs to be outside of the UpdatePanel:

Markup:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

Script:

if( typeof(Sys) != "undefined" )
{
    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(initRequestHandler);     
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);   
}
else
{
    //we have a problem with ScriptManager
}

The call to System.WebForms.PageRequestManager should come after the library has been included and initialized, but probably not inside the UpdatePanel.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!