I''m having an issue with a virtual grid. When I handle SaveCellInfo and set the e.handled to be false, sometimes syncfusion throws an ArgumentException in grid.dll saying that index was out of range: parameter row index. However, I can''t seem to trace which of my calls actually set this. Is this a known issue?
ADAdministrator Syncfusion Team July 23, 2004 08:55 AM
If you are using a virtual grid, then you should more or less always set e.Handled = true in SaveCellInfo. If you do not, the grid will try to store the value in its GridData object. And, unless you have explicitly set grid.RowCount and grid.ColCOunt to be large enough to handle the values you are passing on by setting e.Handled = false, then you will get this error.
So, by default, the grid is sized initially to 10x10 ''real'' rows and columns. So, as long as e.RowIndex and e.ColIndex is less than 10, then you can get away with setting e.Handled = false as the proper space has been allcoated by default. But once the row and col exceed 10x10, then there is a problem. Normally, you would not want to arbitrarily set RowCount and ColCount as one point of a virtual grid is to avoid the grid setting up its own data storage. This is the reason you normally set e.Handled = true in SaveCellInfo as you are normally responsible for saving anything that needs saving, and do not want the grid to save things itself.
Now if you do want the grid to save some things, then you would set e.Handled = false, but you will be responsible to setting the RowCount and ColCount so the grid will have sufficient space allocated to hold what you want it to save.
JKJustin KohJuly 23, 2004 02:19 PM
The reason I was using e.Handled = False was to deny the move and reset the value. What should I do if I want this functionality? Set the e.Style.Text property in SaveCellInfo back?
ADAdministrator Syncfusion Team July 23, 2004 03:36 PM
Normally you would handle the grid.CurrentCellValidating event to validate a changed cell value as you leave the cell. You can getteh new value from grid.CurrentCell.Renderer.ControlText, and if it is not proper, then set e.Cancel = true.