简体   繁体   English

asp.net在新窗口中打开超链接字段

[英]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. 截至目前我正在使用target =“_ blank” ,当我点击“路径”列中的超链接文本时,链接将在新选项卡中打开。 I would like for the link to open in a new window. 我希望链接在新窗口中打开。 Can anyone help? 有人可以帮忙吗?

I am using visual c# 2015 我正在使用visual c#2015

Here is the code I am using to define the columns in my gridview: 这是我用来定义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>
<a href="http://wwww.google.com"  onclick="window.open('http://wwww.google.com', 'newwindow', 'width=300, height=250'); return false;"> Print</a>

尝试这个

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM