I have a gridview (with no properties set) on an aspx page which I populate
from an XML file with the code below.
The data in the XML file looks like this
<description>Na tional Trust for Historic Preservation</description>
<URL>http://www.nthp.org/</URL>
<category>Archi tecture</category>
Can anyone tell me why the other two columns are displayed, but the
hyperlink column does not display in the grid?
The code:
Dim DS As New Data.DataSet
DS.ReadXml(Serv er.MapPath(".") & "\data\Links.xm l")
Dim dt As New Data.DataTable
Dim dr As Data.DataRow
Dim hl As New HyperLink
Dim i As Integer
dt.Columns.Add( New Data.DataColumn ("Descriptio n", GetType(String) ))
dt.Columns.Add( New Data.DataColumn ("URL", GetType(HyperLi nk)))
dt.Columns.Add( New Data.DataColumn ("Category", GetType(String) ))
For i = 0 To DS.Tables(0).Ro ws.Count - 1
dr = dt.NewRow
dr("Description ") = DS.Tables(0).Ro ws.Item(i).Item (0) 'The link's
description
hl.NavigateUrl = DS.Tables(0).Ro ws.Item(i).Item (1) 'the link's URL
hl.Text = DS.Tables(0).Ro ws.Item(i).Item (0) 'description
hl.Target = "_Blank"
dr("URL") = hl
dr("Category") = DS.Tables(0).Ro ws.Item(i).Item (2) 'The link's category
dt.Rows.Add(dr)
Next
Me.GridView1.Da taSource = dt
Me.GridView1.Da taBind()