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

get valuemember of Combobox in GridGroupingControl

Thread ID:





127896 Dec 16,2016 08:36 AM UTC Dec 19,2016 11:50 AM UTC WinForms 1
Tags: GridGroupingControl
Asked On December 16, 2016 08:36 AM UTC

I have a coulmn style Combobox in Gridgroupingcontrol :

grid_HangHoa_DinhLuong.TableDescriptor.GetColumnDescriptor("TEN_NGUYENLIEU").Appearance.AnyRecordFieldCell.DataSource = lst_hh;
grid_HangHoa_DinhLuong.TableDescriptor.GetColumnDescriptor("TEN_NGUYENLIEU").Appearance.AnyRecordFieldCell.DisplayMember = "TEN";
 grid_HangHoa_DinhLuong.TableDescriptor.GetColumnDescriptor("TEN_NGUYENLIEU").Appearance.AnyRecordFieldCell.ValueMember = "ID";

How to get valuemember of selected item of combobox ?

And in my event RecordValueChanged , when i changed item of other column , how to get valuemember of this combobox ?
I only can get the combobox text 

Mohanraj Gunasekaran [Syncfusion]
Replied On December 19, 2016 11:50 AM UTC

Hi Truong, 

Thanks for using Syncfusion products. 

Currently we do not have the direct support to get the value member of ComboBox column when changing the other item column values. But you can achieve your scenario by handling the RecordValueChanged event and use the Dictionary collection(values) to save the DisplayMember values and ValueMember values of ComboBox to achieve your scenario. Please refer the below code snippet and refer the attached sample 

Code snippet: 
this.gridGroupingControl1.Table.RecordValueChanged += Table_RecordValueChanged; 
Dictionary<string, string> values = new Dictionary<string, string>(); 
void Table_RecordValueChanged(object sender, Syncfusion.Grouping.RecordValueChangedEventArgs e) 
    Record record = e.Record; 
    GridTableCellStyleInfo style = (record.ParentTable as GridTable).GetTableCellStyle(record, "Name"); 
    DataTable combo = style.DataSource as DataTable; 
    string valuemember = values.ContainsKey(style.FormattedText.ToString()) ? values[style.FormattedText.ToString()].ToString() : string.Empty; 
    MessageBox.Show("Combo box value member value:" + valuemember); 
private void ComboBoxDisplayMemberValues(DataTable dt) 
    if (dt != null) 
        foreach (DataRow dr in dt.Rows) 
            if (!values.ContainsKey(dr[0].ToString())) 
                values.Add(dr[0].ToString(), dr[1].ToString()); 
Sample link: GridGroupingControl 
Mohanraj G.  


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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