I need to evaluate a grid data item (row) to see if certain fields can be edited based on values in this particular row. I also need to change the style of certain cells in that row if it does becomes editable.
Initially I set the styles of the cells in the ItemDataBound handler if I determine that this row has fields to edit. for example:
dataitem(
"groupid").Style.Add("visibility", "hidden")
this worked just fine.
I then needed to set this row to be editable. (I have the grid to edit inplace). In the ItemDataBound handler, after I set the styles like the one above, I set the row to be editable:
dataitem.edit = true
Initially I did not see the cells become editable (showing textboxes instead of labels).
After reading in the documentation that I need to rebind the grid after I change the edit property, I placed a rebind() in the page's PreRenderComplete handler:
Me
.PreRenderComplete
This now shows the editable columns in the row BUT all of the style changes that I did in the ItemDataBound handler are lost. If I take out the rebind() in the PreRenderComplete the style changes are made but the editable columns are not set.
Is there a way to both set the style of a row dynamically and set it to be editable?