Skip to content Skip to sidebar Skip to footer

Jquery With Update Panel

i have a problem while using jquery context menu and update panels. i am writing the javascript of the context menu in the RenderBeginTag of a Customtextbox control using htmlTextW

Solution 1:

You're right, the updatepanel will remove your javascript bindings.

In your updatepanel postback, re-register the javascript in question.

Something like:

ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(typeof(Page), "ReApplyJavascript", "<script type=text/JavaScript>YourJavascriptInitMethod();</script>", false);

If that doesn't work. You may need to use:

   ScriptManager.RegisterStartupScript(Page, typeof(Page), "ReApplyJavascript", "<script type=text/JavaScript>YourJavascriptInitMethod();</script>", false);

Solution 2:

You need to reinitialize the menou after UpdatePanel Update.

<scripttype="text/javascript">var prm = Sys.WebForms.PageRequestManager.getInstance();    
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);

functionInitializeRequest(sender, args) {      
}

functionEndRequest(sender, args) {
     // Here initialize the menou
}
</script>

Post a Comment for "Jquery With Update Panel"