Click here to Skip to main content
16,018,294 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After login I want to open a web page as a popup in a new window and I want the main page to redirect to my home page. How can I do this? How can I open the pop up from code behind?
Posted
Updated 13-Aug-14 22:27pm
v3

1. To open popup:
VB
Dim queryString As String = "test.aspx" 
Dim newWin As String = "window.open('" & queryString & "');"
ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin, True)

2. To redirect:
VB
Response.Redirect("home.aspx")
 
Share this answer
 
Comments
TheWebDeveloper 14-Aug-14 4:28am    
can I do both? open pop up then redirect without affecting or loading?
Trung Nguyen Son 14-Aug-14 4:31am    
Sure, you can.
First, do open popup and then redirect.

Try it!
TheWebDeveloper 14-Aug-14 4:33am    
It didn't work :(
Dim newWin As String = "window.open('myNewpage.aspx');"
ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin, True)

Response.Redirect("home.aspx")
TheWebDeveloper 14-Aug-14 4:33am    
It didn't work :(
Dim newWin As String = "window.open('myNewpage.aspx');"
ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin, True)

Response.Redirect("home.aspx")
Trung Nguyen Son 14-Aug-14 4:37am    
The redirect should be done in client-side, so the code should be:
Dim queryString As String = "test.aspx"
Dim newWin As String = "window.open('" & queryString & "');"
ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin, True)

ClientScript.RegisterStartupScript(Me.GetType(), "redirect", "'window.location.href = "your page";'", True)
C#
window.location.href = "Home";
  window.open('Yourpage', '_blank');



first code will redirect ur page to home.n second code will open new page in new browser tab..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900