C
CaptRR
Well, it seems as though every time I fix one problem I make yet another.
Anyhow, this is probably an easy one but I haven't found any answers
doing a search so I figured I would ask it here. I have a data grid
with check boxes in it, each check box called chkSelect. If I check
all the checkboxes and run through the code, the value of chkSelect =
false all the time, no matter what the state of the checkbox is.
Heres the code
Dim objItem As DataGridItem
Dim deleteme As Integer
For Each objItem In dgClients.Items
'Ignores the invalid items
If objItem.ItemType <> ListItemType.Header And _
objItem.ItemType <> ListItemType.Footer And _
objItem.ItemType <> ListItemType.Pager Then
'Then retrieve the value of the checkbox
Dim chkTest As CheckBox
Dim blnDelete As Boolean
blnDelete =
CType(objItem.Cells(0).FindControl("chkSelect"), CheckBox).Checked
chkTest = objItem.FindControl("chkSelect")
If blnDelete = True Then
deleteme = CInt(objItem.Cells(1).Text)
dbaddclient.DeleteClient(deleteme)
End If
End If
Next
Note that chkTest is in their just so I can see the state of the
checkbox in debug without the rest of the code getting in the way. It
always reads false.
Anyhow, this is probably an easy one but I haven't found any answers
doing a search so I figured I would ask it here. I have a data grid
with check boxes in it, each check box called chkSelect. If I check
all the checkboxes and run through the code, the value of chkSelect =
false all the time, no matter what the state of the checkbox is.
Heres the code
Dim objItem As DataGridItem
Dim deleteme As Integer
For Each objItem In dgClients.Items
'Ignores the invalid items
If objItem.ItemType <> ListItemType.Header And _
objItem.ItemType <> ListItemType.Footer And _
objItem.ItemType <> ListItemType.Pager Then
'Then retrieve the value of the checkbox
Dim chkTest As CheckBox
Dim blnDelete As Boolean
blnDelete =
CType(objItem.Cells(0).FindControl("chkSelect"), CheckBox).Checked
chkTest = objItem.FindControl("chkSelect")
If blnDelete = True Then
deleteme = CInt(objItem.Cells(1).Text)
dbaddclient.DeleteClient(deleteme)
End If
End If
Next
Note that chkTest is in their just so I can see the state of the
checkbox in debug without the rest of the code getting in the way. It
always reads false.