I need to make some columns ReadOnly conditionally in Item_DataBound
How to I reference the ReadOnly attributeof the column properly here?
I can't do it in Item_Created because I need the bound DataItem.
The following code is setting the wrong item...
How to I reference the ReadOnly attributeof the column properly here?
I can't do it in Item_Created because I need the bound DataItem.
The following code is setting the wrong item...
If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then |
'switch the Item to Allow Edits of ListName if it is UserDefined |
If DirectCast(e.Item.DataItem, InvoiceItem).ItemTypeID = "U" Then |
'switching wrong row? |
DirectCast(e.Item.OwnerTableView.GetColumnSafe("ListName"), GridBoundColumn).ReadOnly = False |
DirectCast(e.Item.OwnerTableView.GetColumnSafe("Amount"), GridBoundColumn).ReadOnly = False |
End If |
The above code sets only the first item in the grid, not the item I am referencing.
I can't seem to access the ReadOnly attribute with anything else.