Open a new page in popup and redirect current page in ASP.net
I ha开发者_如何学运维ve a need to open a new window as well as redirect current page in ASP.net
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "openpopup", _
"Sys.Application.add_load(function() {OpenNewWindow('" & strLocationPath & "');});", True)
I am using the above code for the popup which is working fine.
If I put response.redirect after the above code it is not working but response.redirect is working.
How can I achieve both from code behind.
Please help
The problem is you're using the client side script to create the popup, which never runs because you did a Response.Redirect on the server side. You can add code to your client script to redirect the page after it opens the popup, like below:
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "openpopup", _
"Sys.Application.add_load(function() {OpenNewWindow('" & strLocationPath & "'); location.href='" & strRedirectLocationPath & "';});", True)
精彩评论