ASP.net help :) OnClick : Open a new .aspx in new window

Pho3nix

The Legend
Joined
Jul 31, 2009
Messages
32,885
Reaction score
3,057
Location
On the toilet
As the title states, can any of you guys assist with this? Found a couple idea's googling but nothing is working really don't know whats up:confused:

Tried
Code:
<asp:LinkButton ID="myButton" runat="server" Text="Click Me!" OnClick="myButton_Click" OnClientClick="aspnetForm.target ='_blank';"/>

But suspect I'm using it wrong. Any pointers guys?
 
As the title states, can any of you guys assist with this? Found a couple idea's googling but nothing is working really don't know whats up:confused:

Tried
Code:
<asp:LinkButton ID="myButton" runat="server" Text="Click Me!" OnClick="myButton_Click" OnClientClick="aspnetForm.target ='_blank';"/>

But suspect I'm using it wrong. Any pointers guys?

The quick and easy and dirty way is to add a button, add onclick event on button, add response.Redirect("url") in the event.

note: I haven worked in .net for ages so I am a bit rusty
 
The quick and easy and dirty way is to add a button, add onclick event on button, add response.Redirect("url") in the event.

note: I haven worked in .net for ages so I am a bit rusty

Please ignore, I did not read the question preoperly, I see you want to open a new page not navigate to one.

wont this work? link
 
That's what I've been trying but get this error : Microsoft JScript runtime error: 'aspnetForm' is undefined

Removed the onClientClick="aspnetForm.target ='_blank';" part and it opens the page in the same window :\
 
Last edited:
That's what I've been trying but get this error : Microsoft JScript runtime error: 'aspnetForm' is undefined

Removed the onClientClick="aspnetForm.target ='_blank';" part and it opens the page in the same window :\

Are you setting the target in the onload event?
 
Popups are pretty well blocked these days so they are generally a bad idea...
If you still want to do it that way you will need to do it on the client side via some script if you want to just search popup javascript for lots of examples.

What do you want the new page to do? There might be a better way to do this.
 
Popups are pretty well blocked these days so they are generally a bad idea...
If you still want to do it that way you will need to do it on the client side via some script if you want to just search popup javascript for lots of examples.

What do you want the new page to do? There might be a better way to do this.
Agreed. An alternative solution is to do an overlay on the page with an iframe rendered into it, with the necessary URL being rendered inside the iframe. The jQuery UI framework has a handy and easy to use overlay / DHTML popup function to give you a simple, elegant solution for this.
 
I'm trying to open up a webform. This being Step 2, where the users details would be inputted.Step one a users name was inputted. I hope you guys get what I'm trying to say.
I found a way to open up Step2 on the same page as step1 but this isn't what the client wants at all. Any help would be appreciated.

Also how would I pull the users name into a label on Step2? Hints?
 
I'm trying to open up a webform. This being Step 2, where the users details would be inputted.Step one a users name was inputted. I hope you guys get what I'm trying to say.
I found a way to open up Step2 on the same page as step1 but this isn't what the client wants at all. Any help would be appreciated.

Also how would I pull the users name into a label on Step2? Hints?

If your client insists on a second page, you are going to have to "pop". You can use either the method as I describe earlier which is a javascript method or a straight hyperlink or asp hyperlink with the target set to "_blank". If you want it to open in sequence, I'd look at modal popups as they avoid muli-page navigation and are ideal for detailed input without going further elsewhere on a page.

To pass the name, you can either do a post somewhere backto the server and store in a session which is retrieved when the new page loads or as a request parameter of your new page. If it's not sensitive, request parameter would be fine and easy.
 
Top
Sign up to the MyBroadband newsletter
X