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: NullReferenceException when Activating a cell

Hi, I have a GGC with nested tables and when doing to following operations I get an exception that makes my control totally unusable. Using the attached sample (follow the instructions on the form): 1- Expand a row and click on the child row 2- Filter out that row using the textbox and RowFilter 3- Expand the displayed row 4- Click on the child row -> An exception is thrown here and until the active cell is visible again: - I can''t expand another row - I can''t change the DataSource - a few other things Here is the StackTrace I get when I run in the debugger: System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.Windows.Forms.Grid.Grouping.GridNestedTableControlCellRenderer.SwitchNestedTable(GridNestedTable nestedTable) at Syncfusion.Windows.Forms.Grid.Grouping.GridNestedTableControlCellRenderer.SwitchNestedTableAndRestore(GridNestedTable nestedTable) at Syncfusion.Windows.Forms.Grid.Grouping.GridNestedTableControl.Table_CurrentRecordContextChange(Object sender, CurrentRecordContextChangeEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.Syncfusion.Grouping.ITableEventsTarget.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) at Syncfusion.Grouping.TableDescriptor.Syncfusion.Grouping.ITableEventsTarget.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) at Syncfusion.Grouping.Table.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableBase.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) at Syncfusion.Grouping.Table.NotifyNavigateComplete(Boolean success, Element previousRecord) at Syncfusion.Grouping.CurrentRecordManager.NavigateTo(Element record, Boolean cancelEditIfNotValid, Boolean scrollInView) at Syncfusion.Grouping.CurrentRecordManager.NavigateTo(Element record) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.ControlEnterRecord(Element record) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.OnCurrentCellActivating(GridCurrentCellActivatingEventArgs e) at Syncfusion.Windows.Forms.Grid.GridControlBase.RaiseCurrentCellActivating(Int32& rowIndex, Int32& colIndex, GridSetCurrentCellOptions& options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Activate(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options, Boolean discardChanges) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.OnClick(Int32 rowIndex, Int32 colIndex, MouseEventArgs e) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.RaiseClick(Int32 rowIndex, Int32 colIndex, MouseEventArgs e) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.OnMouseUp(Int32 rowIndex, Int32 colIndex, MouseEventArgs e) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.RaiseMouseUp(Int32 rowIndex, Int32 colIndex, MouseEventArgs e) at Syncfusion.Windows.Forms.Grid.GridSelectCellsMouseController.MouseUp(MouseEventArgs e) at Syncfusion.Windows.Forms.MouseControllerDispatcher.ProcessMouseUp(MouseEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridNestedTableControlCellRenderer.OnMouseUp(Int32 rowIndex, Int32 colIndex, MouseEventArgs e) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.RaiseMouseUp(Int32 rowIndex, Int32 colIndex, MouseEventArgs e) at Syncfusion.Windows.Forms.Grid.GridSelectCellsMouseController.MouseUp(MouseEventArgs e) at Syncfusion.Windows.Forms.MouseControllerDispatcher.ProcessMouseUp(MouseEventArgs e) at Syncfusion.Windows.Forms.ScrollControllMouseControllerDispatcher.ScrollControlBeforeMouseUp(Object sender, CancelMouseEventArgs e) at Syncfusion.Windows.Forms.ScrollControl.OnScrollControlMouseUp(CancelMouseEventArgs e) at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d) catched at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d) in :line 0 I am using Syncfusion 3.0.1.0 Thanks, Marcel Gosselin

GGC-NullReferenceException.zip

3 Replies

AD Administrator Syncfusion Team March 31, 2006 10:18 AM UTC

Hi Marcel, Could you try this code in the TextBox''s TextChanged event this.mainGrid.TableControl.BeginUpdate(); GridTableControl ctc = this.mainGrid.GetTableControl("child"); ctc.BeginUpdate(); DataView view = (this.mainGrid.DataSource as DataTable).DefaultView; if(this.textBox1.Text == "") { view.RowFilter = ""; } else { view.RowFilter = string.Format("[common] like ''%{0}%''", this.textBox1.Text); } ctc.EndUpdate(true); this.mainGrid.TableControl.EndUpdate(true); ctc.Reinitialize(); this.mainGrid.TableControl.Reinitialize(); Here is a modified sample. Exception_GGC.zip Let me know if you need any further assistance. Regards, Haneef


MG Marcel Gosselin March 31, 2006 02:30 PM UTC

Thanks, your solution worked. Why do we need to do this explicitly for every table within the GGC? I would think that a call to BeginUpdate/EndUpdate on the grid would have the logic to call the same function on its TableControls. Thanks, Marcel


AD Administrator Syncfusion Team April 3, 2006 09:09 AM UTC

Hi Marcel, Thanks for your update. In GridGroupingGrid, Each and every childtable as seperate GridTableControl.if you want to change the underlying datasource of the tablecontrol, then you need to call the BeginUpdate and Endupdate method. For more details,See http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=99 Thanks for choosing Syncfusion Products. Regards, Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon