Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

.NET GridView ButtonField link open in new tab

Options
  • 28-09-2011 11:57am
    #1
    Registered Users Posts: 872 ✭✭✭


    Hi,

    I have a gridview that lists records. You can click the ID of a record for more info. This link is created using an asp:ButtonField control.

    The rendered HTML for the clickable link is <a href="javascript:__doPostBack('ctl00$CB$gvResults','linkID$0')">25641</a>

    When you right click this link on the page it only shows 'open' in the context menu and not 'open in new tab'. Is there any way to get both options ('open' & 'open in new tab') visible in the context menu ? I could add target='_blank' using javascript but the client wants the option of having both options instead.

    Thanks in advance for any help.


Comments

  • Registered Users Posts: 527 ✭✭✭Sean^DCT4


    What type of button is the ButtonField, link or an actual button?

    if it is a link, try using an <ASP:HyperLinkField> instead.


  • Registered Users Posts: 2,791 ✭✭✭John_Mc


    As already said, the browser context menu will only give you Open in new tab option when you right click on a hyperlink link. There are different types of button which can be used in a grid view. Button, LinkButton and Imagebutton I think.

    You want to use LinkButton here.


  • Registered Users Posts: 872 ✭✭✭grahamor


    Thanks for the reply. It's a link :

    <asp:ButtonField ButtonType="Link" DataTextField="VendorID" HeaderText="ID" SortExpression="V.VendorID" CommandName="linkID" />

    I will try using the HyperLinkField instead


Advertisement