GridView HyperLinkField Problem

ASP , GridView , HyperLinkField Bristol, United Kingdom
  • 11 years ago


    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

    Thanks in advance for any ideas you might have.

Post a reply

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

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


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Engineers are all basically high-functioning autistics who have no idea how normal people do stuff.” - Cory Doctorow