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 shows ValueMember instead of DisplayMember

After enabling column filtering, I am using the following code the define the filter of a specific column in my GridGroupingControl.

var gcPayeeId = new GridColumnDescriptor
                HeaderText = "Payee",
                MappingName = "PayeeId",
                SortByDisplayMember = true,
                Width = 225
            gcPayeeId.Appearance.AnyRecordFieldCell.CellType = "ComboBox";
            gcPayeeId.Appearance.AnyRecordFieldCell.CellValueType = typeof(int);
            gcPayeeId.Appearance.AnyRecordFieldCell.DataSource = bindingSourcePayee;
            gcPayeeId.Appearance.AnyRecordFieldCell.DisplayMember = "Name";
            gcPayeeId.Appearance.AnyRecordFieldCell.DropDownStyle = GridDropDownStyle.Exclusive;
            gcPayeeId.Appearance.AnyRecordFieldCell.ValueMember = "Id";
            gcPayeeId.Appearance.AnyRecordFieldCell.TextAlign = GridTextAlign.Left;

            gcPayeeId.Appearance.FilterBarCell.DataSource = bindingSourcePayee;
            gcPayeeId.Appearance.FilterBarCell.DisplayMember = "Name";
            gcPayeeId.Appearance.FilterBarCell.ValueMember = "Id";

The filter selection however shows the Payee Id instead of the Payee Name (see attached).

How do I show and filter on the displaymember, rather than the valuemember?


Attachment: DropDownList_with_FK_20feffef.zip

3 Replies

AR Amal Raj U Syncfusion Team December 16, 2016 10:06 AM UTC

Hi Patrick, 

Thanks for using Syncfusion products. 

There is no support for filtering based on Display Member in normal filter bar. We suggest you to use DynamicFilter or ExcelFilter which has support for filtering by display members. Please make use of the below code to enable dynamic filter or excel filter. 

Code Example 
//to wire Dynamic FilterBar. 
GridDynamicFilter dynamicFilter = new GridDynamicFilter(); 
//To wire GridExcelFilter. 
GridExcelFilter excelFilter = new GridExcelFilter(); 


Sample Link 

For more information about DynamicFilter, please refer to the below documentation link, 

For more information about GridExcelFilter, please refer to the below documentation link, 

Amal Raj U. 

PL Patrick Luijpers December 16, 2016 07:13 PM UTC

The example is working, however I am not able to use the same method to make it appear in my app. The Excel filter is showing, however it is not picking up the display members as the filter values. The "lookup" table Payee contains 3 columns (id, name, and isLocked) and is shown correctly when adding or editing records.

I noticed that adding the following code after the grid is specified and data bound cause a stack overflow.
   gridGroupingInvoice.TableDescriptor.Columns["PayeeId"].Appearance.FilterBarCell.DataSource = bindingSourcePayee;
   gridGroupingInvoice.TableDescriptor.Columns["PayeeId"].Appearance.FilterBarCell.DisplayMember = "Name";
   gridGroupingInvoice.TableDescriptor.Columns["PayeeId"].Appearance.FilterBarCell.ValueMember = "Id";

Any help resolving this is greatly appreciated.

Attachment: Excel_Filter_ab756116.zip

MG Mohanraj Gunasekaran Syncfusion Team December 19, 2016 12:43 PM UTC

Hi Patrick, 

Sorry for the inconvenience caused. 

We can able to reproduce your scenario and we have created the new incident for better follow up to your scenario. So can you please follow up on this incident (#169429) using your login for further assistance. 

Mohanraj G.  

Live Chat Icon For mobile
Up arrow icon