Z
Zach Wells
I have a checkbox in the EditItemTemplate column that I *almost* have
working, just stuck on one little thing.
When I click edit on the row, I can display the checkbox as I want, the
only problem is I can't seem to figure out how to get the value that was
there in the checkbox.
This is what I am trying in my ItemBound event:
If (e.Item.ItemType = ListItemType.EditItem) Then
Dim chk As CheckBox
chk = CType(e.Item.Cells(7).FindControl("chkORSecurity_Table"),
CheckBox)
chk.Checked = IIf(e.Item.Cells(7).Text.ToUpper = "YES",
True, False)
End If
The problem is that e.Item>Cells(7).Text returns an empty string,
instead of "YES", which is the value displayed in the cell prior to
clicking edit. I'm assuming that the reason the cell is empty is that
I've already switched to "edit" mode and thus, there is no value in that
field, only my control. So, how do I set the checkbox to the right
value? Where do I get the value that was in the cell prior to clicking Edit?
Zach
working, just stuck on one little thing.
When I click edit on the row, I can display the checkbox as I want, the
only problem is I can't seem to figure out how to get the value that was
there in the checkbox.
This is what I am trying in my ItemBound event:
If (e.Item.ItemType = ListItemType.EditItem) Then
Dim chk As CheckBox
chk = CType(e.Item.Cells(7).FindControl("chkORSecurity_Table"),
CheckBox)
chk.Checked = IIf(e.Item.Cells(7).Text.ToUpper = "YES",
True, False)
End If
The problem is that e.Item>Cells(7).Text returns an empty string,
instead of "YES", which is the value displayed in the cell prior to
clicking edit. I'm assuming that the reason the cell is empty is that
I've already switched to "edit" mode and thus, there is no value in that
field, only my control. So, how do I set the checkbox to the right
value? Where do I get the value that was in the cell prior to clicking Edit?
Zach