title: GridView column losing hyperlink when looping through rows
body: <p>I have an asp.net page written with vb.net that has a gridview table. The table is setup to have a checkbox column for each row. If this checkbox is checked for a row, I do some additional things. One of the other columns also includes a hyperlink on the text for each cell in that column.</p>
  
  <p>I have a button on the page that will loop through and programmatically check each one of the checkboxes. The button does this correctly; however, it also removes the hyperlink from the other column for some reason. Any ideas why?</p>
  
  <p>Here is the code where I set the hyperlinks for the hyperlink column:</p>
  
  <pre><code>Protected Sub gridData_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles gridData.RowDataBound
      'When a row is added to the data grid view we need to add the hyperlink to the zipname column
      If e.Row.RowType = DataControlRowType.DataRow Then
          Dim cell As TableCell = e.Row.Cells(4)
          Dim lnk As HyperLink = New HyperLink
  
          'Set properties of the link
          lnk.NavigateUrl = cell.Text
          lnk.Text = cell.Text
  
          'Format the filename, filepath, zipname, and username to be lowercase
          e.Row.Cells(1).Text = LCase(e.Row.Cells(1).Text)
          e.Row.Cells(3).Text = LCase(e.Row.Cells(3).Text)
          e.Row.Cells(4).Text = LCase(e.Row.Cells(4).Text)
          e.Row.Cells(5).Text = LCase(e.Row.Cells(5).Text)
  
  
          'Add the hyperlink
          cell.Controls.Clear()
          cell.Controls.Add(lnk)
      End If
  End Sub
  </code></pre>
  
  <p>Here is the code for the check all button:</p>
  
  <pre><code> Protected Sub cmdCheckAll_Click(sender As Object, e As EventArgs) Handles cmdCheckAll.Click
      'Check all of the download checkboxes
  
      For Each row As GridViewRow In gridData.Rows
          CType(row.FindControl("CheckBox1"), CheckBox).Checked = True
      Next
  
  End Sub
  </code></pre>