Reputation: 13
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
Reputation: 433
<asp:HyperLink ID="HyperLink1" NavigateUrl='<%# Eval("ID","pathurl.aspx?I={0}") %>' Target="_blank" runat="server">Path</asp:HyperLink>
Upvotes: 1
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