Saturday, March 31, 2012

Set a hyperlink to open in window.

how do you set a hyperlink to open the link in a new window/browser, so I dont lose my current place in the site.

you have to do this with client code

<a href="http://links.10026.com/?link=blah" TARGET="_new"...>

the "_new" is a name you assign to a window. Use that with more then one call and they will reuse the window.

You can't specify the window (new or otherwise) with a Response.Redirect() or any other server call, sorry...


If you need to do this in the code behind and not in the HTML you can use this syntax:

Me.ClientScript.RegisterClientScriptBlock(Me.GetType,"open","<script language=javascript>window.open('http://www.yourpage.aspx');</script>")


Simply the below code

<a href="http://links.10026.com/?link=WebForm1.aspx" target="_blank">Open new window</a>

HC


As everybody as already said

<a href="http://links.10026.com/?link=URL" target="_blank>Clicking on this opens a new window</a>

however if you are using hyperlink button in asp.net then

<asp:HyperLinkid="value"Runat="Server"
ImageUrl="url"
NavigateUrl="url"
Target="_blank|_self|_top|_parent|framename"
Text="string"
property="value"
Style="CSS style settings..."
/>

you can choose target=_blank as described.

Hope that helps and good luck

0 comments:

Post a Comment