sort GridComboBoxColumn by DisplayMember instead by ValueMember

Hi. I need to sort a GridComboBoxColumn by DisplayMember instead of by ValueMember. Currently it's doing it by valuemember. it's grouping correctly by display text when you choose it, but not in sorting. This is my designer code:


          gridComboBoxColumn2.AllowFiltering = true;

            gridComboBoxColumn2.AllowResizing = true;

            gridComboBoxColumn2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;

            gridComboBoxColumn2.AutoSizeColumnsMode = Syncfusion.WinForms.DataGrid.Enums.AutoSizeColumnsMode.ColumnHeader;

            gridComboBoxColumn2.AutoSuggestDelay = 1;

            gridComboBoxColumn2.AutoSuggestMode = Syncfusion.WinForms.ListView.Enums.AutoCompleteSuggestMode.Contains;

            gridComboBoxColumn2.DataSource = this.tbltpproductoBindingSource;

            gridComboBoxColumn2.DisplayMember = "TpProductoDescripcion";

            gridComboBoxColumn2.DropDownStyle = Syncfusion.WinForms.ListView.Enums.DropDownStyle.DropDown;

            gridComboBoxColumn2.GroupMode = Syncfusion.Data.DataReflectionMode.Display;

            gridComboBoxColumn2.HeaderText = "Tipo de producto";

            gridComboBoxColumn2.MappingName = "Producto_TpProductoId";

            gridComboBoxColumn2.ShowFilterRowOptions = false;

            gridComboBoxColumn2.ShowHeaderToolTip = true;

            gridComboBoxColumn2.ShowToolTip = true;

            gridComboBoxColumn2.SortMode = Syncfusion.Data.DataReflectionMode.Display;

            gridComboBoxColumn2.StaysOpenOnEdit = true;

            gridComboBoxColumn2.ValidationMode = Syncfusion.WinForms.DataGrid.Enums.GridValidationMode.InEdit;

            gridComboBoxColumn2.ValueMember = "TpProductoId";


How can i make to sort by displayMember?


1 Reply

VS Vijayarasan Sivanandham Syncfusion Team December 27, 2021 12:07 PM UTC

Hi Jose Leonardo,

By default, the grouping and sorting will be displayed based on the MappingName of combo-box column. This can be changed to display the DisplayMember by using the GroupMode property of the column and also you cans sort the column based DisplayMember by using the  SortMode property of the Column.

Based on provided information we have prepared the simple sample from our end and checked the reported issue “sort GridComboBoxColumn by DisplayMember instead by ValueMember” and unable to replicate the issue from our end. It is working fine as expected. Please find the tested sample and video demo from the below link,

Sample Link: https://www.syncfusion.com/downloads/support/forum/171459/ze/SfDataGridDemo745918468

Video Link: https://www.syncfusion.com/downloads/support/forum/171459/ze/SortingDisplayMember-155954043 

Please have a look at this sample and let us know if we have missed any customization done in your application. Otherwise try to reproduce the reported issue in this sample and revert to us with the modified sample and steps to replicate the issue. It will be more helpful for us to find the exact cause for the issue and to provide a prompt solution. 

Regards, 
Vijayarasan S 


Loader.
Up arrow icon