David Blackwell
David Blackwell

Reputation: 13

asp.net open hyperlinkfield in new window

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>

Upvotes: 1

Views: 4732

Answers (2)

shafi7468
shafi7468

Reputation: 433

   <asp:HyperLink ID="HyperLink1"  NavigateUrl='<%# Eval("ID","pathurl.aspx?I={0}") %>' Target="_blank" runat="server">Path</asp:HyperLink>

Upvotes: 1

KyLim
KyLim

Reputation: 476

<a href="http://wwww.google.com"  onclick="window.open('http://wwww.google.com', 'newwindow', 'width=300, height=250'); return false;"> Print</a>

try this

Upvotes: 0

Related Questions