Viewstate of DataGrid CheckBox control...
Posted on 2006-10-25
I am programmatically adding a checkbox control to my datagrid column (.net 1.1).
What I need to do is capture whether or not it is being checked on postback.
So in an ItemDataBound event I have:
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim chkSelected As CheckBox
chkSelected = e.Item.FindControl("ChkSelection")
If chkSelected.Checked Then
Problem is that the checkbox is always testing as being unchecked - I assume that this is because after postback the checkbox is recreated and it's viewstate has not been saved?!
Does anyone know of a workaround?