Hyperlink column in datagrid

Discussion in 'ASP .Net Datagrid Control' started by ReidarT, Oct 22, 2004.

  1. ReidarT

    ReidarT Guest

    I am trying to insert a hyperlink column in a datagrid
    the field consist of a http://www.something.no/text.asp?id=FieldID
    where FieldID is the field from the sql-server
    I normally would have concatenated the text and the field
    "http:\\www.something.no/text.asp?id=" & FieldID,
    but I don't know how to "grab" the field in the propertybuilder of the
    datagrid.

    reidarT
    ReidarT, Oct 22, 2004
    #1
    1. Advertising

  2. ReidarT

    Jos Guest

    ReidarT wrote:
    > I am trying to insert a hyperlink column in a datagrid
    > the field consist of a http://www.something.no/text.asp?id=FieldID
    > where FieldID is the field from the sql-server
    > I normally would have concatenated the text and the field
    > "http:\\www.something.no/text.asp?id=" & FieldID,
    > but I don't know how to "grab" the field in the propertybuilder of the
    > datagrid.


    I'm afraid you can't do this in a hyperlink column.

    I suggest converting the hyperlink column to a template
    column, and using a databinding expression like this:

    <a href="http://www.something.no/text.asp?id=<%#
    Databinder.Eval(Container.dataItem,"FieldID")
    %>">click here</a>

    --

    Jos
    Jos, Oct 22, 2004
    #2
    1. Advertising

  3. ReidarT

    ReidarT Guest

    Thanks for your answer but this works fine now. If you use the property
    builder and select the field in the URL field and the prefix in the URL
    fromat string it works fine.
    reidarT
    "Jos" <> skrev i melding
    news:%...
    > ReidarT wrote:
    >> I am trying to insert a hyperlink column in a datagrid
    >> the field consist of a http://www.something.no/text.asp?id=FieldID
    >> where FieldID is the field from the sql-server
    >> I normally would have concatenated the text and the field
    >> "http:\\www.something.no/text.asp?id=" & FieldID,
    >> but I don't know how to "grab" the field in the propertybuilder of the
    >> datagrid.

    >
    > I'm afraid you can't do this in a hyperlink column.
    >
    > I suggest converting the hyperlink column to a template
    > column, and using a databinding expression like this:
    >
    > <a href="http://www.something.no/text.asp?id=<%#
    > Databinder.Eval(Container.dataItem,"FieldID")
    > %>">click here</a>
    >
    > --
    >
    > Jos
    >
    >
    ReidarT, Oct 24, 2004
    #3
  4. Jos wrote:
    > ReidarT wrote:
    >
    >>I am trying to insert a hyperlink column in a datagrid
    >>the field consist of a http://www.something.no/text.asp?id=FieldID
    >>where FieldID is the field from the sql-server
    >>I normally would have concatenated the text and the field
    >>"http:\\www.something.no/text.asp?id=" & FieldID,
    >>but I don't know how to "grab" the field in the propertybuilder of the
    >>datagrid.

    >
    >
    > I'm afraid you can't do this in a hyperlink column.
    >
    > I suggest converting the hyperlink column to a template
    > column, and using a databinding expression like this:
    >
    > <a href="http://www.something.no/text.asp?id=<%#
    > Databinder.Eval(Container.dataItem,"FieldID")
    > %>">click here</a>


    You most certainly can have a HyperLinkColumn with a dynamic value in
    the querystring. The downside of a HyperLinkColumn is that it only
    allows *one* dynamic querystring value for the rendered hyperlink. If
    you need two or more values in the querystring that are from the data
    bound to the DataGrid, then you will have to use a TemplateColumn, as
    you mention.

    For more on the HyperLinkCoumn and hyperlinks in DataGrids, check out
    the "Hyperlinks" FAQ section at http://datawebcontrols.com/faqs/




    --

    Scott Mitchell

    http://www.4GuysFromRolla.com

    * When you think ASP.NET, think 4GuysFromRolla.com!
    Scott Mitchell [MVP], Oct 24, 2004
    #4
  5. I have a tricky problem.

    I have a datagrid with multiple rows. In each row, I have a column
    that needs to display multiple hyperlinks.

    In other words each row has an id, seq no. ship no and the potential
    for one or many partcodes. Each part code when clicked needs to open a
    new page based upon that part code.

    I have many rows in the datagrid and each row is unique in that it can
    have one or more than one part code.

    Have any of you done this before?

    I have tried many different ways and have come up empty. Any help
    would be greatly appreciated.

    BUZZMAN

    On Sun, 24 Oct 2004 11:00:43 +0200, "ReidarT" <> wrote:

    >Thanks for your answer but this works fine now. If you use the property
    >builder and select the field in the URL field and the prefix in the URL
    >fromat string it works fine.
    >reidarT
    >"Jos" <> skrev i melding
    >news:%...
    >> ReidarT wrote:
    >>> I am trying to insert a hyperlink column in a datagrid
    >>> the field consist of a http://www.something.no/text.asp?id=FieldID
    >>> where FieldID is the field from the sql-server
    >>> I normally would have concatenated the text and the field
    >>> "http:\\www.something.no/text.asp?id=" & FieldID,
    >>> but I don't know how to "grab" the field in the propertybuilder of the
    >>> datagrid.

    >>
    >> I'm afraid you can't do this in a hyperlink column.
    >>
    >> I suggest converting the hyperlink column to a template
    >> column, and using a databinding expression like this:
    >>
    >> <a href="http://www.something.no/text.asp?id=<%#
    >> Databinder.Eval(Container.dataItem,"FieldID")
    >> %>">click here</a>
    >>
    >> --
    >>
    >> Jos
    >>
    >>

    >
    Bob the Builder, Oct 28, 2004
    #5
    1. Advertising

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. =?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:
    595
    =?Utf-8?B?V2FyYW4=?=
    Aug 9, 2005
  2. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    11
    Views:
    998
    deandany
    Jul 17, 2006
  3. davetichenor
    Replies:
    1
    Views:
    810
    Eliyahu Goldin
    Oct 30, 2006
  4. Keith G Hicks
    Replies:
    3
    Views:
    754
    Keith G Hicks
    Feb 18, 2008
  5. Dave
    Replies:
    0
    Views:
    928
Loading...

Share This Page