Hi, all...
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;
or...
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?
Thanks,
Kevin
AD
Administrator
Syncfusion Team
February 11, 2003 01:50 PM UTC
You need to handle the PrepareViewStyleInfo event if you want to change style information for specific cells.
Stefan
GP
Gwen Pier
February 11, 2003 04:01 PM UTC
> You need to handle the PrepareViewStyleInfo event if you want to change style information for specific cells.
>
> Stefan
Stefan...
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?
Thanks,
Kevin
AD
Administrator
Syncfusion Team
February 11, 2003 04:22 PM UTC
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.
Stefan
PK
Pal Koncsik
March 9, 2003 07:12 PM UTC
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.
AD
Administrator
Syncfusion Team
March 9, 2003 08:49 PM UTC
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.