Results 1 to 6 of 6

Thread: [RESOLVED] Opening new windows with asp:HyperLinkField

  1. #1

    Thread Starter
    Member domJack's Avatar
    Join Date
    Nov 2005
    Posts
    40

    Resolved [RESOLVED] Opening new windows with asp:HyperLinkField

    Hi all,

    Hope someone can offer a few pointers. I have a gridview control with a hyperlink column like this...

    Code:
    <asp:HyperLinkField .... DataNavigateUrlFormatString="./Default.aspx" Target="_blank" />
    Is there any way I can force this to open in a new window, instead of opening a new tab?

    Grateful for any tips!

    Dom

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Opening new windows with asp:HyperLinkField

    You can use javascipt to open a new window but otherwise Target="_blank" will open in a new tab or window depending on the browser settings.

  3. #3

    Thread Starter
    Member domJack's Avatar
    Join Date
    Nov 2005
    Posts
    40

    Re: Opening new windows with asp:HyperLinkField

    Thanks fishcake, thought that might be the case.

    Hmph - javascript it is then!

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Opening new windows with asp:HyperLinkField

    Hello,

    The HyperLinkField has a target property:

    http://msdn.microsoft.com/en-us/libr...ld.target.aspx

    Which if you set to "_blank" will cause the link to open in a new window.

    Gary

  5. #5
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: [RESOLVED] Opening new windows with asp:HyperLinkField

    Quote Originally Posted by gep13 View Post
    Hello,

    The HyperLinkField has a target property:

    http://msdn.microsoft.com/en-us/libr...ld.target.aspx

    Which if you set to "_blank" will cause the link to open in a new window.

    Gary
    domjack was already using Target="_blank" but was asking about always opening a new window rather than the browser deciding whether to open a new tab or a new window.

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Opening new windows with asp:HyperLinkField

    Woah, I completely missed that!! Must have read the original post wrong, and now that I look at it, yours too.

    Apologies!!

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width