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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridFilterBar - Selecting an item in the ListBox

Thread ID:





50761 Oct 18,2006 03:02 PM UTC Oct 18,2006 04:17 PM UTC WinForms 1
Tags: GridControl
Daniel Roesch
Asked On October 18, 2006 03:02 PM UTC


How can I select an item in a GridFilterBar's ListBox programmatically?

listBox.SelectedItem, listBox.SelectedIndex and listBox.SelectedValue don't work.

protected override void OnCreatingColumnHeader(GridFilterBarCreatingColumnHeaderEventArgs e) {
GridCurrentCell cc = _grid.CurrentCell;

if(cc.RowIndex == 1 && cc.ColIndex > 0) {
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
if(cr == null) {
ListBox lb = cr.ListBoxPart;
if(lb == null) {

ArrayList al = ActiveFilters[e.ColName] as ArrayList;
if(al != null) {
if(al.Count == 1 && !e.ColName.Equals(CommonGlobals.FLD_STATUS)) {
DataRowView selectedItem = null;
foreach(DataRowView drv in lb.Items) {
if(drv[0].ToString().Equals(al[0].ToString())) {
selectedItem = drv;
if(selectedItem != null) {
lb.SelectedItem = selectedItem;

// base.OnCreatingColumnHeader (e);

Thanks for your help!!

Administrator [Syncfusion]
Replied On October 18, 2006 04:17 PM UTC

Hi Dan,

If you want to programmatically apply filter, you can set the FilterBar.RowFilter property. Try the code below to do this.

// get the columnindex on which filter must be applied
int col = this.gridDataBoundGrid1.Binder.NameToColIndex("Column Name");

this.gridDataBoundGrid1.Model[1, col].Text = "value"; // filter value
filterBar.RowFilter = "[Column Name] = 'value'";

Let me know if this is not what you needed.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon