1

I have a hyperlinkfield inside of a grid view. As of right now I am using target="_blank" and when I click on the hyperlink text in the 'path' column, the link opens in a new tab. I would like for the link to open in a new window. Can anyone help?

I am using visual c# 2015

Here is the code I am using to define the columns in my gridview:

    <Columns>
        <asp:BoundField DataField="id" HeaderText="id" SortExpression="id" />
        <asp:BoundField DataField="date" HeaderText="date" SortExpression="date" />
        <asp:BoundField DataField="timeOpen" HeaderText="timeOpen" SortExpression="timeOpen" />
        <asp:BoundField DataField="timeClose" HeaderText="timeClose" SortExpression="timeClose" />
        <asp:hyperlinkfield headertext="path"
            datatextfield="path"
            datanavigateurlfields="path"
            datanavigateurlformatstring="https://www.harris.com/{0}"
            target="_blank" />
    </Columns>
  • Possible duplicate of: http://stackoverflow.com/questions/2541392/opening-new-window-in-html-for-target-blank – Boney Nov 29 '16 at 05:10
  • Not a duplicate. This question is specifically about how to open a link in a new window, when the link is generated by the hyperlinkfield asp.net component. – Jack Nov 05 '17 at 10:55

2 Answers2

1
   <asp:HyperLink ID="HyperLink1"  NavigateUrl='<%# Eval("ID","pathurl.aspx?I={0}") %>' Target="_blank" runat="server">Path</asp:HyperLink>
shafi7468
  • 323
  • 1
  • 3
  • 15
0
<a href="http://wwww.google.com"  onclick="window.open('http://wwww.google.com', 'newwindow', 'width=300, height=250'); return false;"> Print</a>

try this

KyLim
  • 468
  • 1
  • 6
  • 22