Tuesday, May 20, 2008

Access Gridview Checkbox in VB.net

For Each row As GridViewRow In GridView1.Rows
' Access the CheckBox
Dim cell As TableCell = row.Cells(7) '7 is Column index
Dim cb As CheckBox = (CType(cell.Controls(1), CheckBox))
If cb IsNot Nothing And cb.Checked Then
sHeader = sHeader & GridView1.DataKeys(row.RowIndex).Value
End If
Next

No comments: