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

3.3.0.0 Filtering Problem

I have a readonly databound datagrid with a custom filter bar that only one clickable column. This column is a two-state checkbox column The correct behaviour is as follows: When this column is set as ''checked'' for example on the filterbar, then when the user unchecks any of the visible rows, that row should be removed from the view since it does not fulfill the filtet any more. That was working properly until I switched from v3.2.1.0 to v3.3.0.0 Since then I am getting the following exception: catched at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d) in :line 0 System.NullReferenceException: Object reference not set to an instance of an object. at System.Data.DataView.FinishAddNew(Int32 currentIndex, Boolean success) at System.Data.DataRowView.EndEdit() at System.Windows.Forms.CurrencyManager.EndCurrentEdit() at System.Windows.Forms.CurrencyManager.ChangeRecordState(Int32 newPosition, Boolean validating, Boolean endCurrentEdit, Boolean firePositionChange, Boolean pullData) at System.Windows.Forms.CurrencyManager.set_Position(Int32 value) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.SetCurrentPosition(Int32 value, Boolean raiseCurrentPositionChanged) at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.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.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) I am using CurrentCellKeyDown event to allow user interaction with the checkbox column, then simply changing its value by code: this.mainGrid[this.mgcc.RowIndex,this.mgcc.ColIndex].CellValue = ! Convert.ToBoolean(this.mainGrid[this.mgcc.RowIndex,this.mgcc.ColIndex].CellValue); and finaly this piece to abort the cell editing mode this.mainGrid.CurrentCell.CancelEdit(); this.mainGrid.Binder.EndEdit(); please advice tks Clark

6 Replies

ST stanleyj Syncfusion Team December 14, 2005 05:01 PM UTC

Hi Clark, Here is a sample that has a similar problem, if only one check box is checked. There is a work around calling Binder.EndEdit() in the CellButtonClicked handler. See if that helps. Best regards, Stanley


AD Administrator Syncfusion Team December 15, 2005 07:36 AM UTC

Hi Stanley, I cannot complile your sample, the due to the "IgnoreCurrentCellInvalidate". If I left this out, It works but the result is not immediate, ie the column is not removed until you move away from it. That was the behavior I had before moving to 3.3.0.0 with the code I mention above. Clark


ST stanleyj Syncfusion Team December 15, 2005 09:31 AM UTC

Hi Clark, You can try that in any appropriate event so as to bring an end to the edit. Try the CurrentCellShowingDropDown or the CurrentCellMoved to see if that helps. GridCurrentCell cc; private void gridDataBoundGrid1_CurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventArgs e) { cc = this.gridDataBoundGrid1.CurrentCell; if(cc.RowIndex == 1) this.gridDataBoundGrid1.Binder.EndEdit(); } Best regards, Stanley


AD Administrator Syncfusion Team December 15, 2005 02:25 PM UTC

Hi Stanley, I tried that as well, it didnt work Stil, It does have the original behaviour, which was immediate removal of the row clicked according the state of the filter. Moreover I dont why endEdit should only happen from cc.RowIndex == 1 (which is the filter row) as your hint suggests ? Clark


ST stanleyj Syncfusion Team December 15, 2005 02:49 PM UTC

Hi Clark, The reason the cc.RowIndex is checked for the filter row is that at the time of filtering your CurrentCell is on that row and endEdit by that time is sufficient. If you can upload your sample we may try suggesting some solutions. Thanks, Stanley


AD Administrator Syncfusion Team December 15, 2005 03:26 PM UTC

I managed to solve this problem by moving away of the current cell. Seems that only when I move away from the row I just clicked, the row becomes hidden since It does not satisfy the filter any more. Maybe this is not the most elegant solution but it works smoothly. in CurrentCellKeyDown event where RowIndex > 2 (to left out the filter row) and ColIndex = my the checkbox column index the following happens: GridCurrentCell cc; cc = this.mainGrid.CurrentCell; int i = cc.RowIndex ; int k = cc.ColIndex; this.myGrid.CurrentCell.CancelEdit(); this.myGrid.CurrentCell.MoveTo(-1,k); this.myGrid.CurrentCell.MoveTo(i,k); If you have another suggestion let me know. Clark.

Loader.
Live Chat Icon For mobile
Up arrow icon