delliottg
delliottg

Reputation: 4140

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

Upvotes: 0

Views: 1748

Answers (1)

dillius
dillius

Reputation: 516

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

Upvotes: 1

Related Questions