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

Virtual grid - change underlying data, Refresh, and get QueryRowCount error

I have a virtual grid that uses my own object model for the data. When I need to change the underlying data, I change the data, then call grid.Refresh() This *eventually* results in calls to QueryRowCount, etc. where I provide the new counts. However...when I call Refresh, the grid apparently first calls Refresh on the currently selected cell (as seen in the call stack for the debug version of the grid assemblies). This causes an error, since the underlying data has been changed to potentially fewer rows, but before the QueryRowCount call comes through, a call to QueryCellInfo comes through for the currently selected cell. Any way to get around this Refresh of the current cell? Note: I tried calling CurrentCell.MoveTo(1,1) before calling the Refresh(), but 2 problems: -- that cell may not always be enabled, so sometimes the call fails to set current cell -- I can *see* the move in the grid, before the refresh happens...not good. Thanks!!

2 Replies

DA Dan August 2, 2004 06:08 PM

p.s. the error is not in QueryRowCount as the subject says, it shows up in QueryCellInfo when I try to hit data that doesn''t exist. My underlying data may only have 10 rows now since it''s been changed, but if a cell in row 20 was the current cell before the refresh, a call comes through to QueryCellInfo for row 20, which doesn''t exist in my underlying data. For now, I''ll put a simple check for this in QueryCellInfo, but wondering if there is a better solution? Thanks!!


AD Administrator Syncfusion Team August 3, 2004 12:45 AM

You can try this. Before you ''refresh'' your external datasource in a manner that may reduce the number of rows/columns, you can call grid.CurrentCell.MoveTo(-1,-1). This normally leaves the grid with no currentcell. I guess you could conditionally make this call so it is only done if necessary.

Loader.
Live Chat Icon For mobile
Up arrow icon