insert a hyperlink column to datgrid

Discussion in 'ASP .Net Datagrid Control' started by TJS, Feb 27, 2004.

  1. TJS

    TJS Guest

    how can I programmatically insert an optional hyperlink column into my
    datagrid which is currently being created from design tags

    I am trying example found as below but with no success. what am I missing?


    ==============code====================
    .... create dataset ...

    MyDataGrid.AutoGenerateColumns = false

    if condition = true then
    ' Add a hyperlink column
    Dim hc1 as new HyperLinkColumn
    hc1.DataTextField = "StringValue"
    hc1.DataTextFormatString = "Show details for {0}"
    hc1.DataNavigateUrlField="IntegerValue"
    hc1.DataNavigateUrlFormatString="details.aspx?ID={0}"
    hc1.HeaderText="Show me more"
    MyDataGrid.Columns.Add (hc1)
    end if

    MyDataGrid.DataSource = ds
    MyDataGrid.DataBind()
    TJS, Feb 27, 2004
    #1
    1. Advertising

  2. Your post went unanswered. Have you resolved this issue?

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "TJS" <> wrote in message
    news:enQrpTP$...
    > how can I programmatically insert an optional hyperlink column into my
    > datagrid which is currently being created from design tags
    >
    > I am trying example found as below but with no success. what am I

    missing?
    >
    >
    > ==============code====================
    > ... create dataset ...
    >
    > MyDataGrid.AutoGenerateColumns = false
    >
    > if condition = true then
    > ' Add a hyperlink column
    > Dim hc1 as new HyperLinkColumn
    > hc1.DataTextField = "StringValue"
    > hc1.DataTextFormatString = "Show details for {0}"
    > hc1.DataNavigateUrlField="IntegerValue"
    > hc1.DataNavigateUrlFormatString="details.aspx?ID={0}"
    > hc1.HeaderText="Show me more"
    > MyDataGrid.Columns.Add (hc1)
    > end if
    >
    > MyDataGrid.DataSource = ds
    > MyDataGrid.DataBind()
    >
    >
    Alvin Bruney [MVP], Mar 2, 2004
    #2
    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. Atif Jalal

    Totaling a column in Datgrid

    Atif Jalal, Jan 21, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,093
    Alvin Bruney
    Jan 24, 2004
  2. =?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:
    601
    =?Utf-8?B?V2FyYW4=?=
    Aug 9, 2005
  3. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    11
    Views:
    1,009
    deandany
    Jul 17, 2006
  4. davetichenor
    Replies:
    1
    Views:
    821
    Eliyahu Goldin
    Oct 30, 2006
  5. Dave
    Replies:
    0
    Views:
    935
Loading...

Share This Page