make hyperlink open in new tabhttp://forums.asp.net/t/1207885.aspx/1?make+hyperlink+open+in+new+tabThu, 28 May 2009 19:32:18 -040012078852119735http://forums.asp.net/p/1207885/2119735.aspx/1?make+hyperlink+open+in+new+tabmake hyperlink open in new tab how do you make an asp:hyperlink open in a new tab when you click it? (rather than the same window)<br> 2008-01-19T14:57:40-05:002119745http://forums.asp.net/p/1207885/2119745.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>I don't think you can open a window in a new tab at the moment when browsers support CSS3&nbsp;you&nbsp;will have the ability open a window in a new&nbsp;tab. This is written about in the W3C standards, you can see it here: <a href="http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/">http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/</a></p> 2008-01-19T15:10:04-05:002121373http://forums.asp.net/p/1207885/2121373.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p></p> <blockquote><span class="icon-blockquote"></span> <h4>raklos</h4> how do you make an asp:hyperlink open in a new tab when you click it? (rather than the same window)<br> </blockquote> &nbsp; <p></p> <p>Hi raklos,</p> <p>Base on my experience, you can refer the following code to solve your problem: <br> </p> <pre class="prettyprint">&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;hyperlinkDemo.aspx.cs&quot; Inherits=&quot;hyperlinkDemo&quot; %&gt; &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt; &lt;head runat=&quot;server&quot;&gt; &lt;title&gt;hyperlink Demo&lt;/title&gt; &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt; function openNewWindows(){ <b>window.open(&quot;http://www.asp.net&quot;);</b> } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt; &lt;div&gt; &lt;asp:HyperLink ID=&quot;hlDemo&quot; runat=&quot;server&quot; <b>onclick=</b><b>&quot;openNewWindows()&quot;</b> <b>style=</b><b>&quot;cursor:pointer; text-decoration:underline;</b>&quot;&gt;HyperLink Demo &lt;/asp:HyperLink&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre><pre class="prettyprint"><br>Let me know if I have misunderstood what you mean. Thanks.<br><br>Hope it helps,<br><br>Hong Gang </pre> 2008-01-21T05:24:11-05:002121393http://forums.asp.net/p/1207885/2121393.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>&nbsp;just insert target=&quot;_blank&quot; in that tag like this:</p> <p>&lt;asp:HyperLink ID=&quot;hyp&quot; NavigateUrl=&quot;~/aboutus.aspx&quot; runat=&quot;server&quot; Text=&quot;click&quot; <b>Target=&quot;_blank&quot;</b>&gt;&lt;/asp:HyperLink&gt;</p> <p>&nbsp;Bye</p> <p>Prashant.&nbsp;</p> 2008-01-21T05:34:12-05:002121398http://forums.asp.net/p/1207885/2121398.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>Insert target property of hyperlink as target&nbsp;= &quot;_blank&quot;..</p> <p>hope that solves the problem.</p> 2008-01-21T05:36:17-05:002121538http://forums.asp.net/p/1207885/2121538.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>Hi raklos </p> <p>yov can set Target Property of that Hyperlink to<strong> _blank</strong></p> <p>or if You are calling javascript on <strong>OnClick</strong> event then Write<strong> Window.open(&quot;Page to open&quot;)</strong></p> <p>Priya.</p> 2008-01-21T06:48:12-05:002121892http://forums.asp.net/p/1207885/2121892.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>&lt;asp:HyperLink Target=&quot;_blank&quot; ID=&quot;lnkBlogSite&quot; NavigateUrl=&quot;http://realfantasy.wordpress.com&quot; Text=&quot;My Blog Site&quot; runat=&quot;server&quot;&nbsp; /&gt;&nbsp;</p> <p>if browser support TABs it will surely work &nbsp;</p> 2008-01-21T09:43:04-05:002121906http://forums.asp.net/p/1207885/2121906.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>SET Property of hyper link<br> </p> <p>Target=&quot;_blank&quot;&nbsp;</p> 2008-01-21T09:55:00-05:002267480http://forums.asp.net/p/1207885/2267480.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>Set Target to &quot;_blank&quot;, Javascript will just base on IE 7 's setting. If IE 7 use open a new window as default setting. It will open a new window. if not, it will open a new tab.</p> 2008-03-31T23:58:47-04:002399593http://forums.asp.net/p/1207885/2399593.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>Hi All,</p> <p>Can this also be done for a Link button within a grid view? i.e something&nbsp; like this to open in a new tab rather than a new window...i tried this and it returned a new window instead of a new tab!!</p> <p>i also tried changing the target to &quot;_new&quot; still no luck and i am uisng IE7 browser..any suggestions please?</p> <p>&lt;asp:gridview ID=&quot;gvbooks&quot; runat=&quot;server&quot;&gt;</p> <p>&lt;Columns&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TemplateField&nbsp; ItemStyle- horizontalAlign=&quot;Center&quot;&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ItemTemplate&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;a id=&quot;lnkDetails&quot; runat=&quot;server&quot; target=&quot;_blank&quot;&gt;details&lt;/a&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ItemTemplate&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TemplateField&gt;&nbsp;</p> <p>&lt;/Columns&gt;</p> <p>&lt;/asp:gridview &gt;</p> 2008-06-04T04:34:16-04:002399732http://forums.asp.net/p/1207885/2399732.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>Hi Guys,</p> <p>what gives??? i looked at this post:</p> <p><a href="http://forums.asp.net/p/1176140/2399710.aspx#2399710">http://forums.asp.net/p/1176140/2399710.aspx#2399710</a>&nbsp;</p> <p><a href="http://forums.asp.net/members/Mikesdotnetting.aspx"><font color="#034efa">Mikesdotnetting</font></a>&nbsp;&nbsp;Mike's answer</p> <p>&nbsp;and then re-visited my code as it says Linkbutton cannot open a new tab so i tried using a hyperlink as suggested, it only worked partially it did display my details page in the&nbsp;EXISTING tab and not a NEW Tab, hence i can not see my original Page where i clicked the link from in my Gridview, as it has not been replaced by the details page, i want the details page in anew tab and not use my original tab of my master page...any suggestions ? thanks!&nbsp;&nbsp;</p> <p>&lt;asp:gridview ID=&quot;gvbooks&quot; runat=&quot;server&quot;&gt;</p> <p>&lt;Columns&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TemplateField&nbsp; ItemStyle- horizontalAlign=&quot;Center&quot;&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ItemTemplate&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;a id=&quot;lnkDetails&quot; runat=&quot;server&quot; target=&quot;_blank&quot;&gt;details&lt;/a&gt;// i was using a link button before so now i switched to a hyperlink..line below</p> <font color="#0000ff" size="2"> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</font><font color="#a31515" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#a31515" size="2">HyperLink</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;lnkDetails&quot;</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Target</font><font color="#0000ff" size="2">=&quot;_blank&quot;</font><font size="2"> </font><font color="#ff0000" size="2">NavigateUrl</font><font color="#0000ff" size="2">=&quot;~/PMDetail.aspx&quot;&gt;</font><font size="2">Details</font><font color="#0000ff" size="2">&lt;/</font><font color="#a31515" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#a31515" size="2">HyperLink</font><font color="#0000ff" size="2">&gt;</p> </font> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ItemTemplate&gt;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TemplateField&gt;&nbsp;</p> <p>&lt;/Columns&gt;</p> <p>&lt;/asp:gridview &gt;</p> 2008-06-04T05:43:56-04:002399753http://forums.asp.net/p/1207885/2399753.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>1. Opening&nbsp; in a new tab is entirely a browser setting. No solution is GUARANTEED to work in any and all of IE7, FF and Opera. Period.</p> <p>2. If the browser is set up properly (with open links in tabs), setting target to _blank or using window.open('url') will both work. The js is preferred as some believe that target mau cause validation issues.</p> 2008-06-04T05:57:22-04:002408139http://forums.asp.net/p/1207885/2408139.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>Yes thanks ,i already solved that issue, I just think the previous posts above where not being clear enough, if you are telling some one to use the Target=&quot;_blank&quot; then you you point out that they need to adjust their Browser settings that is in IE7 under Tools menu ---&gt; internet options---&gt; General&nbsp; under the Tabs Section they need to click on the open a new Tab in current window radiobutton.</p> <p>Then it will work, as i tested everyones solution above which is correct but did not work until the I Changed the Browser Settings.</p> <p>&nbsp;</p> <p>thanks</p> 2008-06-07T08:19:26-04:002603986http://forums.asp.net/p/1207885/2603986.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>&nbsp;This is the most simple way to write a hyperlink</p> <p>&lt;a href=&quot;http://www.wickedawesomefilms.com&quot; <b>TARGET=&quot;_BLANK&quot;&gt;</b>Wickedawesomefilms.com&lt;/a&gt;<br> This will open a link in a new tab without leaving the browser your using.&nbsp; <br> </p> 2008-09-05T22:39:58-04:003093625http://forums.asp.net/p/1207885/3093625.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab &lt;div class=ForumPostBodyArea&gt; &lt;div class=ForumPostContentText&gt; <p>hi,</p> <p>&nbsp;You can aslo use below code:</p> <font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">HyperLink</font><font size="2"> </font><font color="#ff0000" size="2">ID</font><font color="#0000ff" size="2">=&quot;lnkCompany&quot;</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">onClick</font><font color="#0000ff" size="2">=&quot;window.open('http://www.ems-works.com/aboutus.aspx','mywindow','width=800,height=400,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes')&quot;</font><font size="2">&nbsp;</font><font color="#ff0000" size="2">&nbsp; Text=&quot;Home&quot;</font><font size="2">&nbsp;</font><font color="#ff0000" size="2">Width</font><font color="#0000ff" size="2">=&quot;80px&quot;&gt;&lt;/</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">HyperLink</font><font color="#0000ff" size="2">&gt;</p> </font>&lt;/div&gt;&lt;/div&gt; 2009-04-16T06:34:09-04:003179161http://forums.asp.net/p/1207885/3179161.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>Hi all,&nbsp; I am also trying to click on my hyperlink and for it to open up in a different tab, but no such luck.</p> <p>&nbsp;What if you have your code inside a content page?&nbsp; Will it still work?</p> <p>Here is my code, &lt;%@ Page Language=&quot;VB&quot; MasterPageFile=&quot;~/MasterPage.master&quot; AutoEventWireup=&quot;false&quot; CodeFile=&quot;Quiz_home.aspx.vb&quot; Inherits=&quot;Quiz_home&quot; title=&quot;Quiz page&quot; EnableSessionState =&quot;True&quot; %&gt;</p> <p><br> &lt;asp:Content ID=&quot;Content1&quot; ContentPlaceHolderID=&quot;ContentPlaceHolder1&quot; Runat=&quot;Server&quot;&gt;<br> &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;width: 100%; height: 100%&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td colspan=&quot;2&quot; style=&quot;height: 60px;&quot; align=&quot;center&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:HyperLink ID=&quot;HyperLink1&quot; NavigateUrl=&quot;c:\web\DAS\Training\TNG_1/index.html&quot;&nbsp; runat=&quot;server&quot; Visible=&quot;False&quot;&gt;Lesson 1&lt;/asp:HyperLink&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;<br> &lt;/table&gt;<br> &lt;/asp:Content&gt;</p> <p>&nbsp;Thanks,</p> 2009-05-21T18:33:43-04:003179265http://forums.asp.net/p/1207885/3179265.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>&lt;asp:HyperLink <strong>Target=&quot;_blank&quot;</strong> ...</p> 2009-05-21T19:12:43-04:003193775http://forums.asp.net/p/1207885/3193775.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>If I have to pass a variable to the next page how can I do it?</p> <p>for example ID=&lt;%# Eval(&quot;ID&quot;)%&gt; <br> </p> 2009-05-28T15:03:18-04:003194409http://forums.asp.net/p/1207885/3194409.aspx/1?Re+make+hyperlink+open+in+new+tabRe: make hyperlink open in new tab <p>Add a querystring aparameter to the NavigateUrl. So, something like:</p> <p>&lt;asp:HyperLink Target='_blank&quot; NavigateUrl='SecondPage.aspx?id=1234' ...</p> <p>And on the second page, you can retrieve the value by </p> <p>string valueOfParameterNamedId = Request[&quot;id&quot;];</p> 2009-05-28T19:32:18-04:00