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

Out of range error - again

I've already posted an issue regarding out-of-range errors when trying to access a cell in a virtual grid, where row and col counts are provided by Query event handlers. When accessing cells outside the QueryCellInfo handler, the grid seems to limit its range of available cells to the number of rows and cols supplied at creation time and not the one supplied by subsequent calls to the query?count event handlers thus the grid will raise an out of range exception trying to access cells outside the initial range, regardless of the fact the the RowCount and ColCount properties indicates a larger range available. I've added an example, where a virtual grid is manually created in form_load, and ResetVolatileData is called to force the grid to update its row and col counts using Query?Count event handlers. A button is added, that tries to modify a cell value somewhere within the range of cells. This causes an out of range error, regardsless of the fact, that row and col index seems to be inside the range of cells now shown by the grid. A commented line has been added to the form_load method, setting the initial value of rowcount to 1000, and suddenly the grid allows the cell to be modified. This must be an error .. or perhaps i've overlooked something You need to have Syncfusion 1.6 installed to compile the example Regards Per Millard Senior Software Architect PBJ Consult A/S Denmark

4 Replies

AD Administrator Syncfusion Team November 5, 2003 10:16 AM UTC

Did you attach the sample you intended to attach? This sample has references to other 3rd party controls, but no Syncfusion references in it. Or, am I missing something?

PM Per Millard November 5, 2003 10:24 AM UTC

Sorry ... my fault ... seems to be the wrong project .. this should be the right example Per > Did you attach the sample you intended to attach? > > This sample has references to other 3rd party controls, but no Syncfusion references in it. > > Or, am I missing something?

AD Administrator Syncfusion Team November 5, 2003 11:09 AM UTC

Thank you for your sample. Dynamically providing rowcount in QueryRowCount does not allocate storage inside the grid. Explicitly setting grid.RowCount = xxx, does allocate storage to hold values. So normally, if you handle QueryRowCount, you would also handle QueryCellInfo and SaveCellInfo to avoid the need for internal storage in your grid. Instead, you would use your external data store to get and set values into the grid with these additional two events. In your sample, you handle QueryRowCount you set the row count, but you are relying on the default SaveCellInfo behavior which expects the data store to be allocated in the grid to hold data. This is why you are getting the exception. So, if you do want the grid to hold the data, there is no need for QueryRowCount, you can just explicitly set grid.RowCount an this allows things to work. If you want the data to be stored in your m_data object, then you need to add QueryCellInfo and SaveCellInfo handlers to implement this behavior. And, this will avoid the problem you are seeing. Attached is your sample back with this modification. Since your m_data was just an array of strings, the sample just uses the single string for every value on the row.

PM Per Millard November 5, 2003 11:23 AM UTC

Thanx Clay I think I get the picture. This is probably also why I have some problems with a checkbox i've added. The checkbox can't store its state, since no cell storage is allocated. Its really kinda obvious when you think of it .. Thanx again, I might get back to you if I run in to other problems ... I hope you don't mind Regards Per

Live Chat Icon For mobile
Up arrow icon