Hyperlink Column URGENT!!!

Discussion in 'ASP .Net Building Controls' started by Christopher Calhoun, Jan 19, 2004.

  1. Does anyone Know how to programmatically assign all the columns in a
    DataGrid with AutoGenerateColumns set to true as Hyperlink Columns?

    Thanks in Advance....
     
    Christopher Calhoun, Jan 19, 2004
    #1
    1. Advertising

  2. If it is urgent, you might want to check the January 19th answer to your
    post in microsoft.public.dotnet.framework.aspnet.datagridcontrol

    Anyway, here's the old answer:


    Hi Christopher,
    Not sure why you'd want to do that, but here's a way to substitute the text
    from a cell with a hyperlink:
    Private Sub DataGrid1_ItemDataBound _
    (ByVal sender As Object, ByVal e As _
    System.Web.UI.WebControls.DataGridItemEventArgs) _
    Handles DataGrid1.ItemDataBound
    Dim tblcell As TableCell
    Dim intCounter As Integer
    Dim hlnkcntrl As HyperLink
    For intCounter = 0 To e.Item.Cells.Count - 1
    tblcell = e.Item.Cells(intCounter)
    hlnkcntrl = New HyperLink
    hlnkcntrl.Text = tblcell.Text
    hlnkcntrl.NavigateUrl = "thepage.aspx"
    tblcell.Text = ""
    tblcell.Controls.Add(hlnkcntrl)
    Next
    End Sub
    Ken
    MVP [ASP.NET]
    "Christopher Calhoun" <> wrote in message
    news:%...
    > Does anyone Know how to programmatically assign all the columns in a
    > DataGrid with AutoGenerateColumns set to true as Hyperlink Columns?
    >
    > Thanks in Advance....
    >
    >
    >


    "Christopher Calhoun" <> wrote in message
    news:%...
    > Does anyone Know how to programmatically assign all the columns in a
    > DataGrid with AutoGenerateColumns set to true as Hyperlink Columns?
    >
    > Thanks in Advance....
    >
    >
     
    Ken Cox [Microsoft MVP], Jan 26, 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. =?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:
    612
    =?Utf-8?B?V2FyYW4=?=
    Aug 9, 2005
  2. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    11
    Views:
    1,018
    deandany
    Jul 17, 2006
  3. davetichenor
    Replies:
    1
    Views:
    856
    Eliyahu Goldin
    Oct 30, 2006
  4. Dave
    Replies:
    0
    Views:
    968
  5. Christopher Calhoun

    HyperLink Column URGENT!!!

    Christopher Calhoun, Jan 19, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    100
    Alvin Bruney
    Jan 19, 2004
Loading...

Share This Page