Does ClientScriptmanager work when called in partial postback?

I would like to close the browser window when the ASP.NET operation was successful. The code below is triggered by a button located in the Ajax UpdatePanel.

Page.ClientScript.RegisterClientScriptBlock(typeof(LeaveApproval), "ShowSuccess", "<script language=javascript>window.opener=self; self.close();</script>"); 

However, this code has no effect. The window is not closed. When I enter javascript in the URL bar of my browser, it works fine, so I assume this is due to using ClientScriptManager along with Ajax.

Any idea what I'm doing wrong?

+3
javascript ajax
source share
1 answer

This Scott Kluppel link helped me solve the problem ...

Rather, use ...

 ScriptManager.RegisterStartupScript 

instead

 Page.ClientScript.RegisterClientScriptBlock. 
+4
source share

All Articles