Setting field value in EditItemTemplate column

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top