We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Setting GridStyleInfo properties

I've just started working with the Syncfusion Grid and thought I would try the sample code at 3.4.1 (in the user guide) to set the style of a range of cells. The code looks pretty simple, but I cannot get it to work. Well, that's not the whole truth, it does work with a new born grid on the form, but I tried using the same code with a grid I have set up to be bound in virtual mode and it doesn't work in that case. I'm only new to the grid but it seems strange that the code to change cell appearance now does not work just because the grid is getting its data a different way?

3 Replies

WH Wayne Hartell December 17, 2002 07:16 PM UTC

More to the point, if I handle the QueryCellInfo event, the ChangeCells method doesn't work. Changing the TableStyle BackColor, however, does work. Looking at the GridStyleInfo order of precedence this doesn't seem to make sense. If the TableStyle BackColor is working (being displayed) then it seems logical that the BackColor property is not set anywhere higher in the hierarchy, so why doesn't changing the cells directly work? This should be higher up in the heirarchy right? i.e., CellStyle?


AD Administrator Syncfusion Team December 17, 2002 08:41 PM UTC

With pure virtual mode the grid itsself does not store the data. You need then provide both handler for QueryCellInfo and SaveCellInfo. When you call ChangeCells, the grid will trigger SaveCellInfo events for every cell that needs to be changed. You have to provide a SaveCellInfo event handler where you save the style information (or the part of the style information you are interested in, e.g. the CellValue) in a data source that you provide. If you just want to mix virtual supply of data with the grids internal datasource, make sure you do not set e.Handled = true for the QueryCellInfo event handler. That way you can just supply the part of the style information that is specific in your scenario and let the grid load the rest from its internal data store. Check out also the VirtualGrid sample and VirtualGrid tutorial. Stefan


WH Wayne Hartell December 18, 2002 12:14 PM UTC

Thanks Stefan. I had not yet read the documentation on the virtual grid (I had just looked at a code sample). Yeah, the mixed mode is exactly what I want. I want to supply the data to the grid, but I'm happy to let it take care of its own styles since in my intended application I think I can get away with using only base and/or column and row styles which I'd imagine are pretty efficient anyway.

Loader.
Live Chat Icon For mobile
Up arrow icon