I have a datagrid with a checkbox in it. I am trying to loop through the grid so I can check if the checkbox is checked. My Code:
The bold text denotes where the error is being thrown from. In the previous line of code I am trying to set chkSelected to the checkbox control which has an ID of "chkSelection." Can anyone tell me what I am doing wrong?
Any help is appreciated.
-Kevin
Code:
Dim dgItem As DataGridItem
Dim chkSelected As CheckBox
Dim intCorrespondenceID As Integer
For Each dgItem In dgReadyForLetter.Items
chkSelected = CType(dgReadyForLetter.FindControl("chkSelection"), CheckBox)
[b]If chkSelected.Checked Then[/b]
'do some stuff
End If
Next
The bold text denotes where the error is being thrown from. In the previous line of code I am trying to set chkSelected to the checkbox control which has an ID of "chkSelection." Can anyone tell me what I am doing wrong?
Any help is appreciated.
-Kevin