Community discussion forum

GridView HyperLinkField Problem

  • 4 months ago

    Hi,

    I've coded the following, which correctly displays the "name" field from my datasource in the GridView column but does not show it as a hyperlink. I want to be able to click on the hyperlink and be redirected to the site identified in the "url" field. Has anyone any idea why this doesn't work?

                        Dim hyper As New HyperLinkField
                        hyper.DataTextField = "name"
                        hyper.Target = "_blank"
                        Dim str(0) As String
                        str(0) = "url"
                        hyper.DataNavigateUrlFields = str
                        hyper.DataNavigateUrlFormatString = "{0}"
                        hyper.ItemStyle.HorizontalAlign = HorizontalAlign.Center
                        hyper.HeaderText = "link"
                        Dim Col As DataControlField = hyper
                        GridView1.Columns.Add(Col)
    

    Thanks in advance for any ideas you might have.

    Post was edited on 02/07/2009 11:34:23 Report abuse

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!