GridView HyperLinkField Problem

ASP , GridView , HyperLinkField Bristol, United Kingdom
  • 8 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.

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” - Tom Cargill