简体   繁体   中英

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>
<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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