Ability to set cells as 'readonly'

Topics: Developer Forum, New Control Requests, User Forum
Feb 8, 2007 at 9:23 AM

Is there a way for me to set cells as read only at runtime? eg depending on my row Id I could set the first row returned in the grid to be readonly and display the values in their ItemTemplate instead of their EditItemTemplate?

I can disable the cells so they cant be edited, but this leaves them in their EditItemTemplate.
Feb 8, 2007 at 2:42 PM
Sorted with the help of a member at asp.net

Feb 28, 2007 at 3:54 PM
I am using Matt's BulkEditGridview currently and have run into a problem when trying to programtically set the grid to read only in my pageload. Whenever I do a postback on that page I get a viewstate exception. The bulk edit gridview is in a usercontrol that contains a boolean property that I set for ReadOnly. In the pageload of the control I do a simple check:
(doing this from memory so syntax may be off in this example)
if ReadOnly
  gridview1.ForcedRowState = ForcedRowState.Normal
The page first renders fine and the grid is in read-only mode BUT when you do a postback the exception occurs.
Any ideas or suggestions on how I can dynamically change the bulk edit gridview to readonly mode if desired?