How to Redirect to Another Already Open Page (Managing Multiple Open Pages in ASP.Net)

T

TC

Hello,

In ASP.Net via C#, but if someone can help me with a VB.Net example that's
fine too, I am trying to redirect to a page that is already open.

For example, when a user clicks a submit button on the main page, a new
window is opened that displays the material. The user then goes back to the
main page and makes changes and clicks the submit button again.

Rather than opening a new window again, I want the user to be redirected to
the original second page.

Does anybody have VB.Net or C# sample code for this?

Thanks & Regards,

TC
 
S

Shiva

Give a name for the new window - 2nd parameter for window.open(). If the
browser finds a window opened already with the given name, then it will
reuse it.

E.g.:

var p = window.open ("http://www.google.com", "Google");
p.focus();

Hello,

In ASP.Net via C#, but if someone can help me with a VB.Net example that's
fine too, I am trying to redirect to a page that is already open.

For example, when a user clicks a submit button on the main page, a new
window is opened that displays the material. The user then goes back to the
main page and makes changes and clicks the submit button again.

Rather than opening a new window again, I want the user to be redirected to
the original second page.

Does anybody have VB.Net or C# sample code for this?

Thanks & Regards,

TC
 
T

TC

Shiva,

Thanks a bunch!

I finally understand. I was having some trouble with the javascript
implementation.

I will post a code sample in a bit for all of those who are to follow.

Best Regards,

TC
 
T

TC

Below is code that, for the most part, works. However, one has to click the
button twice in order to actually re-direct with focus.

private void btnNewPDFWindow_Click(object sender, System.EventArgs e)

{

string NewPage = "NewPageZoom.aspx";

string ScriptBlockNewPage = "<script language='javascript'>var
NewPDFPage=window.open('" + NewPage + "','PDFPage');";

ScriptBlockNewPage = ScriptBlockNewPage + "NewPDFPage.focus();</script>";

Response.Write(ScriptBlockNewPage);

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top