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 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!
1. Opening 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.
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.
"If I can see further than anyone else, it is only because I am standing on the shoulders of giants."blog: www.heartysoft.com twitter: @ashic
Marked as answer by HeartattacK on May 02, 2009 09:31 AM
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="_blank" then you you point out that they need to adjust their Browser settings that is in IE7 under
Tools menu ---> internet options---> General under the Tabs Section they need to click on the open a new Tab in current window radiobutton.
Then it will work, as i tested everyones solution above which is correct but did not work until the I Changed the Browser Settings.
<a href="http://www.wickedawesomefilms.com" TARGET="_BLANK">Wickedawesomefilms.com</a>
This will open a link in a new tab without leaving the browser your using.
ShadowOfTheB...
Member
130 Points
68 Posts
Re: make hyperlink open in new tab
Jun 04, 2008 05:43 AM|LINK
Hi Guys,
what gives??? i looked at this post:
http://forums.asp.net/p/1176140/2399710.aspx#2399710
Mikesdotnetting Mike's answer
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 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!
<asp:gridview ID="gvbooks" runat="server">
<Columns>
<asp:TemplateField ItemStyle- horizontalAlign="Center">
<ItemTemplate>
<a id="lnkDetails" runat="server" target="_blank">details</a>// i was using a link button before so now i switched to a hyperlink..line below
<
asp:HyperLink id="lnkDetails" runat="server" Target="_blank" NavigateUrl="~/PMDetail.aspx">Details</asp:HyperLink></ItemTemplate>
<asp:TemplateField>
</Columns>
</asp:gridview >
William shakespeare, Hamlet
HeartattacK
All-Star
55262 Points
5917 Posts
Moderator
MVP
Re: make hyperlink open in new tab
Jun 04, 2008 05:57 AM|LINK
1. Opening 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.
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.
blog: www.heartysoft.com
twitter: @ashic
ShadowOfTheB...
Member
130 Points
68 Posts
Re: make hyperlink open in new tab
Jun 07, 2008 08:19 AM|LINK
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="_blank" then you you point out that they need to adjust their Browser settings that is in IE7 under Tools menu ---> internet options---> General under the Tabs Section they need to click on the open a new Tab in current window radiobutton.
Then it will work, as i tested everyones solution above which is correct but did not work until the I Changed the Browser Settings.
thanks
William shakespeare, Hamlet
roads
Member
2 Points
1 Post
Re: make hyperlink open in new tab
Sep 05, 2008 10:39 PM|LINK
This is the most simple way to write a hyperlink
<a href="http://www.wickedawesomefilms.com" TARGET="_BLANK">Wickedawesomefilms.com</a>
This will open a link in a new tab without leaving the browser your using.
rsanuj
Member
9 Points
11 Posts
Re: make hyperlink open in new tab
Apr 16, 2009 06:34 AM|LINK
hi,
You can aslo use below code:
<asp:HyperLink ID="lnkCompany" runat="server" onClick="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')" Text="Home" Width="80px"></asp:HyperLink> </div></div>hyperlink description css
RangerBud
Member
167 Points
37 Posts
Re: make hyperlink open in new tab
May 21, 2009 06:33 PM|LINK
Hi all, I am also trying to click on my hyperlink and for it to open up in a different tab, but no such luck.
What if you have your code inside a content page? Will it still work?
Here is my code, <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Quiz_home.aspx.vb" Inherits="Quiz_home" title="Quiz page" EnableSessionState ="True" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
<tr>
<td colspan="2" style="height: 60px;" align="center">
<asp:HyperLink ID="HyperLink1" NavigateUrl="c:\web\DAS\Training\TNG_1/index.html" runat="server" Visible="False">Lesson 1</asp:HyperLink>
</td>
</table>
</asp:Content>
Thanks,
HeartattacK
All-Star
55262 Points
5917 Posts
Moderator
MVP
Re: make hyperlink open in new tab
May 21, 2009 07:12 PM|LINK
<asp:HyperLink Target="_blank" ...
blog: www.heartysoft.com
twitter: @ashic
robinspaul
Member
180 Points
462 Posts
Re: make hyperlink open in new tab
May 28, 2009 03:03 PM|LINK
If I have to pass a variable to the next page how can I do it?
for example ID=<%# Eval("ID")%>
HeartattacK
All-Star
55262 Points
5917 Posts
Moderator
MVP
Re: make hyperlink open in new tab
May 28, 2009 07:32 PM|LINK
Add a querystring aparameter to the NavigateUrl. So, something like:
<asp:HyperLink Target='_blank" NavigateUrl='SecondPage.aspx?id=1234' ...
And on the second page, you can retrieve the value by
string valueOfParameterNamedId = Request["id"];
blog: www.heartysoft.com
twitter: @ashic