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

Filter on Gridboundcolumns

Thread ID:

Created:

Updated:

Platform:

Replies:

103878 Jun 6,2012 02:36 PM UTC Jun 19,2012 03:36 AM UTC WinForms 3
loading
Tags: GridControl
Paul Mulder
Asked On June 6, 2012 02:36 PM UTC

I want to filter a databoundgridcolumn (dropdown type) based on another databoundgridcolumn (also dropdown type).

In other words, I select first column from dropdown (that is linked to a bindingsource for values), which in turn limits the choices on the second column dropdown (also linked to a different bindingsource) based on the first selection.

For ease of understanding, the first column could be country and the second column could be state. There are no relations set up between these datasources, but should it be required, I could probably look into that.

 


Ragamathulla B [Syncfusion]
Replied On June 7, 2012 04:17 AM UTC

Hi Paul,

Thank you for your interest in syncfusion products.

You can bind the datasource dynamically based on the selected value inside ‘CurrentCellShowedDropDown’ event. The following code explains the same.

void gridDataBoundGrid1_CurrentCellShowedDropDown(object sender, EventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (cc.ColIndex == 2)
//column that need to be filtered...
{
GridComboBoxCellRenderer cr = (GridComboBoxCellRenderer)cc.Renderer;
if (cr != null)
{
string text = gridDataBoundGrid1[cc.RowIndex, 1].Text;
if (text == "One")
{
((GridComboBoxListBoxPart)cr.ListBoxPart).DataSource = GetTable1();
((GridComboBoxListBoxPart)cr.ListBoxPart).DisplayMember = "Col2";
((GridComboBoxListBoxPart)cr.ListBoxPart).ValueMember = "Col1";
}
else
{
((GridComboBoxListBoxPart)cr.ListBoxPart).DataSource = GetTable();
((GridComboBoxListBoxPart)cr.ListBoxPart).DisplayMember = "Col1";
((GridComboBoxListBoxPart)cr.ListBoxPart).ValueMember = "Col2";
}
}

}
}

Please refer to the following sample which illustrates the same.

http://www.syncfusion.com/downloads/Support/DirectTrac/87557/ComboBoxGDBG-2065197015.zip

Please let me know if you have any further concerns.

Regards,
Ragamathullah B.


Paul Mulder
Replied On June 18, 2012 08:08 PM UTC

Thank you. Solved it


Ragamathulla B [Syncfusion]
Replied On June 19, 2012 03:36 AM UTC

Hi Paul,

Thanks for the update.

Please let me know if you have any further concerns.

Regards,

Ragamathullah B.


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.

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

;