简体   繁体   中英

Using NavigateUrl, how to open a new window instead of a tab in the browser?

I've got a page that presents a bunch of part numbers to my users. I want a new window to open when the user clicks on a part number. The MSDN page for NavigateURL seems to indicate that I just put Target="_blank" in the properties for the Hyperlink, but that just pops a new tab (in Chrome if it matters).

How do I get it to pop a new window instead of a new tab? I tried to delete the DataNavigateUrlFormatString property because it seemed extraneous, but it didn't like that and told me that "Target was not a valid option for a hyperlink" , or something to that effect (if it's important I can get the exact error).

Here's my code:

<asp:HyperLinkField HeaderText="Part Number"
DataTextField="partNumber"
DataNavigateUrlFields="partNumber"
DataNavigateUrlFormatString="PartLookup.aspx?partNumber={0}"
NavigateUrl="PartLookup.aspx?partNumber={0}"
Target="_blank"/>

The browser being used decides how to handle being given a target="_blank" , and you can not control whether it chooses to make a new tab or window.

You can use Javascript to force the opening of a new window, but I do not believe that can be done through your HyperLinkField directly.

See this issue for Javascript

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