DetailsView Hyperlink

Last post 07-09-2009 11:34 AM by mreyeros. 1 replies.

Sort Posts:

  • DetailsView Hyperlink

    07-09-2009, 9:38 AM
    • Member
      7 point Member
    • mjwill97
    • Member since 09-29-2008, 5:34 PM
    • Posts 18

     I have a DetailsView that has databound template fields. I would like to have one of the fields be a hyperlink.  I would like the hyperlink to change depending on the detail page for the item I am looking at.

    Example:

    DetailsView for Server1 - field1 - http://www.page.com/Server1

    DetailsView for Server2 - field1 - http://www.page.com/Server2

     

    I am assuming it needs to be something like the following:

    <a href="www.page.com?ServerName=DatabaseField">ServerName</a>

     

    I am using Visual Studio 2005 and have done mostly everything thus far in design view.  Any help would be greatly appreciated.

  • Re: DetailsView Hyperlink

    07-09-2009, 11:34 AM
    Answer
    • Contributor
      3,583 point Contributor
    • mreyeros
    • Member since 12-05-2002, 5:32 AM
    • Miami, FL USA
    • Posts 647

    Good morning, you can use a HyperlinkField like follows:

    <asp:HyperLinkField HeaderText="Column Name" DataTextField="DBFieldName" DataNavigateUrlFields="DBFieldName" DataNavigateUrlFormatString="http://www.page.com/{0}" />


     

    --------------------------------------------------
    Sincerely,
    Michael Reyeros

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    If my solution doesn't solve your problem, just feel free to mark it as not answer and reply.
Page 1 of 1 (2 items)