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.
Unfortunately, activation email could not send to your email. Please try again.

Tracking down a bug

Thread ID:





28446 May 2,2005 02:55 PM May 2,2005 07:16 PM Windows Forms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On May 2, 2005 02:55 PM

We have a virtual grid derived from GridControl. I have a series of automated tests using NUnit and NUnit Forms to perform various tests on the grid control. One of the tests is failing and it''s odd because I can''t seem to reproduce the problem with interactive testing. I''m also having a real problem tracking down the cause. I''ve traced into the grid and it starts at GridModel.SetCellInfo To back up a bit, my grid has 1 row of column headers and 1 column of row headers. The data is two columns wide and 3 rows in length. So my overall grid is 3x4 The grid is populated with some strings. In my test, I click on cell 1,1, (first data cell) type some data into the cell, and then click on cell 0, 1. As I said, the problem starts at end of GridModel.SetCellInfo. The line where it''s occuring is: Data[r, c] = (GridStyleInfoStore) store2.Clone(); r = 1, c = 1 This calls the GridData indexer which calls the SFTable indexer. The call into the SFTable indexer has 1 added to both the column and row indexes, so it''s sfTable[2, 2] SFTable has a row count of 2 and a column count of 2. So, obviously my my row index of 2 and my col index of 2 are now outside of the sfTable, so it throws an ArgumentOutOfRangeException on the row index. Why would this be? The grid otherwise seems to be working fine. This is the only test that''s failing and I simply don''t understand what''s going on here exactly. Thanks for any help you can provide.

Administrator [Syncfusion]
Replied On May 2, 2005 06:26 PM

Since you are using a virtual gridcontrol, the grid.Data object does not allocate any space to hold values unless you explicitly set grid.RowCount and grid.ColCount. Are you setting these values? Also, in a virtual grid, you should be saving values in SaveCellInfo, setting e.handled = true to indicate the values get saved. Is this being done? Either of these situations can give a index out of range error.

Administrator [Syncfusion]
Replied On May 2, 2005 06:57 PM

Clay, I never explicitly set the row or column count. I simply handle the the QueryColumnCount and QueryRowCount events. Our grid is databound, but we use our own data binding code, not the syncfusion databound grid control, just to be clear. In the SaveCellInfo event, I''ve do the following check: if (null != dataSource_ && e.Style.Store.IsValueModified(GridStyleInfoStore.CellValueProperty)) If this is the case, I set the value back to the datasource and set e.Handled = true. The SaveCellInfo event gets called a second time, but I''m not sure what it''s for. The second time, the IsValueModified() for CellValue is not returning true. Could it be this second event that''s causing it to fall through to the Syncfusion grid? Should I always return e.Handled=true whether I do anything or not? Thanks. Pete

Administrator [Syncfusion]
Replied On May 2, 2005 07:16 PM

If you never want the grid to save anything, you probably should always set e.Handled = true in SaveCellInfo. This may be why you are seeing this exception.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.