ReadWriteAuthorization for DataGridView

ReadWriteAuthorization for DataGridView

Old forum URL: forums.lhotka.net/forums/t/2044.aspx


bgilbert posted on Thursday, December 28, 2006

Is there any simple way to affect columns in a DataGridView by using the ReadWriteAuthorization component the same way you would with simple controls? If not, what's the preferred way to call the CanReadProperty/CanWriteProperty methods to hard code this? It seems that these cannot be exposed as shared methods like CanEditObject.

Thanks in advance.

Brian Criswell replied on Thursday, December 28, 2006

I am sure that it could be extended to include the DataGridView, but in the meantime, you may want to check to see if you can make cells editable or read-only as CanReadProperty/CanWriteProperty could change from row to row.

ajj3085 replied on Friday, December 29, 2006

That's a good point.  Probably the best way to handle this would be on an event that fires as each row is processed by the grid.  Infragistics grid for example has RowInitialize.

Thunderstruck replied on Friday, December 29, 2006

I have a co-worker who used a delegate against the DataGridView.BackColor property, "pointing" it to a function that would return an integer value (corresponding to a color) if a particular criteria was met or not.  If I'm not mistaken, this falls under .NET's complex binding feature.

I don't see why this approach wouldn't work using the DataGridView.ReadOnly property.

Copyright (c) Marimer LLC