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
close icon

Interrogating the FilterBar

Hi all,

I understand that if I handle the QueryCellStyleInfo event of the GridGroupingControl I can access almost every "cell" within the grid, including the FilterBar. In my particular setup I have dropdown filters set for specific columns, and what I'd like to be able to do is query the selected value of these DropDownLists so that I can perform a database query based upon these values (instead of relying on the default filtering behaviour of the grid).

I'm having a tricky time finding where abouts I can access this information (assuming it is possible). I've been investigating the GridTableCellStyleInfoEventArgs parameter that is passed into the QueryCellStyleInfo event and have been looking specifically at the TableCellIdentify.FilterBarSummaryDescriptor property to see if I can ascertain the value of the filter dropdowns, but to no avail. Does anyone have an example of how this might be done?

If I'm going about this the wrong way, please let me know.

Kind regards,

Matt

1 Reply

LS Lingaraj S Syncfusion Team September 18, 2009 01:33 PM UTC

Hi Matt,

Thank you for your interest in Syncfusion products.

If you want get a FilterBarCell selected value, then please try using TableControlCurrentCellCloseDropDown event in GridGroupingControl to achieve your behavior. Because only the DisplayText only is passed to GridGroupingControl.

Refer the code below:

Hashtable tab = new Hashtable();
// Form Load
this.gridGroupingControl1.TopLevelGroupOptions.ShowFilterBar = true;
this.gridGroupingControl1.TableDescriptor.Columns["Ship"].AllowFilter = true;
this.gridGroupingControl1.TableControlCurrentCellCloseDropDown += new GridTableControlPopupClosedEventHandler(gridGroupingControl1_TableControlCurrentCellCloseDropDown);
tab.Add("Ship", "");
// Event definition
void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e)
{
GridTableCellStyleInfo sty = e.TableControl.CurrentCell.Renderer.StyleInfo as GridTableCellStyleInfo;
if (sty.TableCellIdentity.TableCellType == GridTableCellType.FilterBarCell)
{
GridComboBoxCellRenderer ren = e.TableControl.CurrentCell.Renderer as GridComboBoxCellRenderer;
tab[sty.TableCellIdentity.Column.Name] = ren.ListBoxPart.SelectedItem;
}
}


Refer the sample from below link:
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/Forums/GGCFilterValue.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.

Loader.
Live Chat Icon For mobile
Up arrow icon