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

Thread ID:

Created:

Updated:

Platform:

Replies:

127888 Dec 15,2016 07:39 PM UTC Dec 19,2016 12:43 PM UTC WinForms 3
loading
Tags: GridGroupingControl
Patrick Luijpers
Asked On December 15, 2016 07:39 PM UTC

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?

Thanks,
Patrick

Attachment: DropDownList_with_FK_20feffef.zip

Amal Raj Umapathy Selvam [Syncfusion]
Replied On 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(); 
dynamicFilter.WireGrid(this.gridGroupingControl1); 
 
//To wire GridExcelFilter. 
GridExcelFilter excelFilter = new GridExcelFilter(); 
excelFilter.WireGrid(this.gridGroupingControl1); 

 

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, 


Regards, 
Amal Raj U. 


Patrick Luijpers
Replied On 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

Mohanraj Gunasekaran [Syncfusion]
Replied On 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. 


Regards, 
Mohanraj G.  


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

;