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

Filter feature

hi, I need to implement the Filter feature in a grid. We are trying to use the regular grid instead of the GridDataBoundGrid. have few issues. 1. Is is possibel to use the GridFilterBar for the ''GridControl'' ? 2. is it possible to manually add items in the filter combo? By default, it loads all items in the column. 3. If FilterBar is supported only by the ''GridDataBoundGrid'', is it possible to use the GridDataBoundGrid, but manually populate the data instead of using the DataSource ? Thanks for any help. - ToJo

1 Reply

AD Administrator Syncfusion Team July 22, 2004 07:42 PM UTC

1 & 3 - The GridFilterBar is only supported for the GridDataBoundGrid using a DataTable as its DataSource. The reason for this is that the filtering is actually done using a DataView.RowFilter property. 2) For any combobox cell (including a combobox in the filter cell), you can dynamically adjust the droplist by handling CurrentCellShowingDropDown.
//assume dataTable1 is the full datatable that is the datasource for the combobox column....
private void gridDataBoundGrid1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid.CurrentCell;
	if(cc.ColIndex == 2)
  //column that need to be filtered...
		GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
		if(cr != null)
			DataView dv = new DataView(dataTable1);
			dv.RowFilter = string.Format("[MyCol1] = ''{0}''", this.gridDataBoundGrid1[cc.RowIndex, 1].Text);

	((GridComboBoxListBoxPart)cr.ListBoxPart).DataSource = dv;

Live Chat Icon For mobile
Up arrow icon