|
-
Sep 27th, 2004, 11:04 AM
#1
Thread Starter
Fanatic Member
How to open a new browser window from ASPX page *RESOLVED*
I really could do with knowing how to open a new browser window with an aspx page from an aspx page.
I currently have a response.redirect call in the click event of a button. When the button is clicked i need to display an aspx page in a new window.
Last edited by davidrobin; Sep 28th, 2004 at 10:34 AM.
-
Sep 27th, 2004, 11:51 AM
#2
Lively Member
Sorry, did this in C# so just make the changes to your vb.net...
Instead of using Response.Redirect() declare a string with the following jscript code:
string scriptString = "<script language=JScript >";
scriptString += "window.open('[name of .aspx page]','_blank','menubar=no,resizable=no,scrollbars=yes,toolbar=no,height=400,width=650');";
scriptString += "</script>";
Then once you have this declared, use RegisterStartupScript()
if(!Page.IsStartupScriptRegistered("Startup"))
Page.RegisterStartupScript("Startup", scriptString);
You can look up the Window.Open() command on the MSDN at
http://msdn.microsoft.com/library/de...ods/open_0.asp
Don't know if this works for Netscape. Worth a try though and hope this helps you.
-
Sep 28th, 2004, 03:05 AM
#3
Thread Starter
Fanatic Member
That works an absolute treat.
I only had to make minimal changes and put all the code in the button click event.
I was wondering if some should go in form load and some in the button click but it works.
As for netscape, it is policy for all machines have IE so no problems there.
-
Sep 28th, 2004, 07:54 AM
#4
Lively Member
I keep it all in the click event. No need to have code all over the place when keeping it all local does the trick.
Glad to have helped.
-
Sep 28th, 2004, 10:33 AM
#5
Thread Starter
Fanatic Member
Good to know I did it right then.
It worked so all is well.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|