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

GridFilterBar Questions

First, is it possible to have a filterbar not filter certain columns? So some columns in the grid will allow filtering while other columns in the same grid will not. Also I noticed that if I start entering a new record in a GDBG then before completing the record I change the filter in a column for which I haven''t entered data in the new row yet. The new row stays in the filtered selection, but if I try to click on the new row again I get an IndexOutOfRangeException. It appears that when going back to the newly created row, the grid is trying to use it''s index before the filter, which is then out of range after the filter is run. I assume this is a bug in the way the GDBG handles filtering, but in any case I need a way to work around it. Thanks

2 Replies

AD Administrator Syncfusion Team May 25, 2005 03:36 PM UTC

1) Handle the FilterBarCreatingColumnHeader event. In the event handler, you can disallow filtering for a column. Searc for "don''t try filter these columns" in the GridFilterBar sample we ship. 2) You can avoid this problem by handling the CurrentCellMoving event and either cancel the changes or save them if you are clicking a filterbar cell.
private void gridDataBoundGrid1_CurrentCellMoving(object sender, GridCurrentCellMovingEventArgs e)
{
	if(this.gridDataBoundGrid1.Binder.IsAddNew &&
		this.gridDataBoundGrid1.CurrentCell.MoveToRowIndex == 1)
	{
		this.gridDataBoundGrid1.CurrentCell.EndEdit();
		this.gridDataBoundGrid1.Binder.EndEdit();
		// or maybe this.gridDataBoundGrid1.Binder.CancelEdit();
	}
}


AD Administrator Syncfusion Team May 25, 2005 03:38 PM UTC

Thank you for the very quick response.

Loader.
Up arrow icon