How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink

Discussion in 'ASP .Net' started by davetichenor, Oct 30, 2006.

  1. davetichenor

    davetichenor Guest

    I have a column which has either "Yes" or "No" as the data - I want only the
    "No"'s values to be a Hyperlink -

    Clicking "No" would then take then to hyperlink - along with member's
    membership ID (which is another column in the datagrid).

    Hyperlink = ../Cardio.aspx?OMEMBID={0}

    Any assistance would be nice.

    thanks

    Dave
     
    davetichenor, Oct 30, 2006
    #1
    1. Advertisements

  2. Dave,

    Make an ItemTemplate consisting of a link and a label. Handle RowDataBound
    (ItemDataBound in 1.1) event. In the event use Item.DataItem property to
    check the column value. If it is "Yes", show the label and hide the link. If
    it is "No", hide the label, set the link's url and show the link.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]


    "davetichenor" <> wrote in message
    news:OCZ5rID$...
    >I have a column which has either "Yes" or "No" as the data - I want only
    >the
    > "No"'s values to be a Hyperlink -
    >
    > Clicking "No" would then take then to hyperlink - along with member's
    > membership ID (which is another column in the datagrid).
    >
    > Hyperlink = ../Cardio.aspx?OMEMBID={0}
    >
    > Any assistance would be nice.
    >
    > thanks
    >
    > Dave
    >
    >
    >
    >
    >
    >
     
    Eliyahu Goldin, Oct 30, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hai Nguyen
    Replies:
    0
    Views:
    501
    Hai Nguyen
    Jan 16, 2004
  2. =?Utf-8?B?UGF1bA==?=

    datagrid-how to get cell value(hyperlink column)

    =?Utf-8?B?UGF1bA==?=, Oct 12, 2004, in forum: ASP .Net
    Replies:
    9
    Views:
    9,124
    =?Utf-8?B?UGF1bA==?=
    Oct 13, 2004
  3. =?Utf-8?B?V2FyYW4=?=

    HyperLink Column and Button Column in a DataGrid

    =?Utf-8?B?V2FyYW4=?=, Aug 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    743
    =?Utf-8?B?V2FyYW4=?=
    Aug 9, 2005
  4. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    11
    Views:
    1,197
    deandany
    Jul 17, 2006
  5. Bren
    Replies:
    3
    Views:
    7,917
  6. Replies:
    1
    Views:
    157
    Elton Wang
    Oct 10, 2005
  7. Dave
    Replies:
    0
    Views:
    1,204
  8. Tim Chase
    Replies:
    7
    Views:
    486
    Dennis Lee Bieber
    Jul 20, 2012
Loading...