I need to implement a grid using virtual mode, however, when the event for QueryCellInfo gets called for a particular cell, I need to set its value according to a value already on the same grid.
However, if I try accessing the other cell directly (using Grid[x,y]) I get a Recursive call detected exception.
Also, if I set a cell to a particular value and set its tag to class, is there a way I can keep QueryCellInfo from trying to reload that cell. I tried checking the tag of the QueryCellInfoEventArgs passed in however it seems the cell object is always reset, even after it has been called once before.
Thanks, and I hope I have explained myself clearly.
ADAdministrator Syncfusion Team February 26, 2004 05:19 PM
If it is a virtual grid, then the values for the grid should be coming from some outside dtatsource. So, in QueryCellInfo, why can you not retrieve the needed value directly from the outside datasource instead of trying to retrieve it by indexing the grid.
Normally, you can avoid recursion in QueryCellInfo in the following manner. Suppose you need to know the value for grid[2,4] in QueryCellInfo. In this case, you can check for e.ColIndex == 4 and e.RowIndex ==2. If this is true, then the value you want (grid[2,4] is just e.Style.CellValue. If it is not true, then you can access grid[2,4] without triggering recursion.
But this is only needed when the grid stores the data in its data object. When the data is from some external data source, you should try getting it directly from the data source, and not through the the grid with an indexer.