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.

3.3.0.0 Filtering Problem

Thread ID:

Created:

Updated:

Platform:

Replies:

38515 Dec 14,2005 09:49 AM Dec 15,2005 10:26 AM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On December 14, 2005 09:49 AM

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

stanleyj [Syncfusion]
Replied On December 14, 2005 12:01 PM

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

Administrator [Syncfusion]
Replied On December 15, 2005 02:36 AM

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

stanleyj [Syncfusion]
Replied On December 15, 2005 04:31 AM

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

Administrator [Syncfusion]
Replied On December 15, 2005 09:25 AM

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

stanleyj [Syncfusion]
Replied On December 15, 2005 09:49 AM

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

Administrator [Syncfusion]
Replied On December 15, 2005 10:26 AM

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.

CONFIRMATION

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.

;