title: I want to add a hyperlink field in ASP.Net to a gridview control or the data behind it
body: <p>I am dynamically generating a gridview control on the fly.  I need to set one of the fields to a hyperlink, and set the value to a dynamic URL.  My code so far is:</p>
  
  <pre><code> Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged
   Dim strCol As String = GridView1.SelectedRow.Cells(5).Text.ToString
   Dim files As String() = IO.Directory.GetFiles(("z:/medadmissions/ap/entering2014/" &amp; strCol &amp; "/"))
   Dim strURL As String
   Dim HLF As HyperLinkField
  
   Dim dt As New DataTable
   dt.Columns.Add("Name")
   dt.Columns.Add("Document Type")
  
   For Each f As String In IO.Directory.GetFiles("z:\medadmissions\ap\entering2014\" &amp; strCol &amp; "\")
      Dim r As DataRow = dt.NewRow
      r("Name") = IO.Path.GetFileName(f)
  
      strURL = "z:\medadmissions\ap\entering2014\" &amp; strCol &amp; "\" &amp; r("Name").ToString
  
      'Want to add this column as a Hyperlink column with strURL
      r("Document Type") = "Type"
  
   Next f
  
  
  
   Dim gv As New GridView
   gvFiles.DataSource = dt
   gvFiles.DataBind()
  
  
   End Sub
  </code></pre>
  
  <p>I imagine there is an easy way to tell the column labeled "Document Type" that I am wanting it to pass a hyperlink.  What am I missing?</p>
  
  <p>Thank you,</p>
  
  <p>David</p>