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

GGC: Exception thrown after editting a cell

Hi, I''m having a problem with a Grouping Grid Control. I have one of these grids with a dataset as data source. One of the columns contanis decimal numbers, with the format "0.00". The grid also has a summary row for that column, with the same format. The exception comes when I edit a cell on that column. The program performs some operations on the columnchanged event of the datatable, which add and remove some rows. All that operations are performed successfully, and then it''s when the exception is thrown. This is the text of the exception: System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.Windows.Forms.Grid.Grouping.GridRecord.Syncfusion.Windows.Forms.Grid.Grouping.IGridTableCellStyleChanged.RaiseTableCellStyleChanged(GridTableCellStyleInfoEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoIdentity.OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.EndUpdate() at Syncfusion.Windows.Forms.Grid.GridCellModelBase.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.ApplyFormattedText(String text) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.OnSaveChanges() at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.RaiseSaveChanges() at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown) catched at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown) in :line 0 I have another grid, almost with the same data, in other part of the program. It does the same operations when editting a cell on the same column, and it doesn''t throw any exception. Any clue of what may be happening here? Thanks a lot in advance! Roberto Obispo

3 Replies

AD Administrator Syncfusion Team November 16, 2005 08:29 PM UTC

Try handling the SourceListListChanged event and tell the grid not reset the currentrecord when the datasource is changed from outside the grid to see if this has any effect on this problem.
private void gridGroupingControl1_SourceListListChanged(object sender, TableListChangedEventArgs e)
{
	e.ShouldResetCurrentRecord = false;
}


RO Roberto Obispo November 17, 2005 07:45 AM UTC

Hi, Clay. It has no effect... I''ve also tried removing any format/style on the column, but keeps showing the same error. The dataset has no errors after the operations triggered by the edition. Any other suggestions? Thanks a lot Roberto


AD Administrator Syncfusion Team November 17, 2005 09:57 AM UTC

Are there multiple threads involved? If so, whenever you are interacting with the grid in some manner, are you doing a grid.InvokeRequired check to make sure you are on the thread that created the grid? If not, you can get null references and other miscellaneous errors like this. Another thing to try. Since you are dynamically adjusting the rows in your datasource inside a column changed event, the grid may be in teh middle of handling the initiating change, and removing/inserting rows at this point may be causing the problem (though the event suggested above tries to avoid these situations but just in case...). Something to try is to not directly do the work of inserting / removing the data inside your ColsChanged event handler. Instead, raise a timer event to postpone this work slightly so the ColsChnaged event can return and let the grid complete its work. Then in the timer Tick event, do the work of removing/adding the rows. (This is just something to try to ID the problem.) If you own the source code for our libraries, you can build a debug version and be able to drill down into the exception to see exactly what the null value is, and that may point to some way to avoid this. If you can upload a sample project showing this issue, we can try debugging it here.

Loader.
Live Chat Icon For mobile
Up arrow icon