I'm using the data bound grid, and cannot figure out how to disable individual cells at runtime.
The grid is bound to a datatable...at runtime, I want to disable individual cells...I was trying to do
mygrid.Model[row,col].Enabled = false;
mygrid[row,col].Enabled = false;
...for specific row/col combinations [this code fires AFTER the grid has been populated]. However, the code doesn't have any effect.
So how can I disable individual cells in a databound grid?
ADAdministrator Syncfusion Team February 11, 2003 08:50 AM
You need to handle the PrepareViewStyleInfo event if you want to change style information for specific cells.
GPGwen PierFebruary 11, 2003 11:01 AM
> You need to handle the PrepareViewStyleInfo event if you want to change style information for specific cells.
Thanks for your response. I'm fairly new to EssentialGrid, so I'm not overly famililar with this event.
1) When does this fire? On a cell-by-cell basis?
I tried to look up this event in the documentation, but couldn't find much. Can you point me in the direction of a useful sample that I can read, to get an idea of how I'd apply it?
ADAdministrator Syncfusion Team February 11, 2003 11:22 AM
It's fired on cell-by cell basis. Check out the Grid\Samples\DataBound\GDBGMultiHeader sample. There you will find an override for this event.
There should be also other samples that handle this event.
PKPal KoncsikMarch 9, 2003 02:12 PM
Funny, this does not work with ReadOnly. I had to resort to the enabled property, because the setting was given dynamically in this event was simply ignored. Seems to me the databound grid has some rough edges.
ADAdministrator Syncfusion Team March 9, 2003 03:49 PM
With the ReadOnly property, you probably would need to handle the Model.QueryCellInfo, change the e.Style there as well as setting e.Handled = true. The reason is that ReadOnly is a property that is checked other than when the cell is drawn. The PrepareViewStyleInfo event is used to setup the style for drawing.