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

Related Dropdown(ComboBox) with GridGroupingcontrol

I want change ComboBox items by some condition in each row.
I found a solution in Enum localizatin sample. But it doesn't work.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
            var el = e.TableCellIdentity;
            var item = el.DisplayElement != null ? el.DisplayElement.GetData() : null;

            if (item is Employee &&
                el.Column != null &&
                el.Column.FieldDescriptor != null &&
                el.Column.FieldDescriptor.FieldPropertyType.IsEnum &&
                (el.DisplayElement.Kind == DisplayElementKind.Record
                 || el.DisplayElement.Kind == DisplayElementKind.AddNewRecord))
                var context = new TypeDescriptorContext(item, e.Style.PropertyDescriptor);
                var converter = e.Style.PropertyDescriptor.Converter;
                if (converter != null)
                    var contextualValues = converter.GetStandardValues(context).OfType<object>().ToArray();
                    e.Style.CellType = "ComboBox";
                    if (!checkBox1.Checked)
                        e.Style.DataSource = contextualValues;

private System.Collections.ICollection GetContextualCollection(Context employeeContext)
            switch (employeeContext)
                case Context.Employed:
                    return new Collection<Status>{ Status.Married, Status.Single, Status.Widow };
                case Context.OnVacation:
                    return new Collection<Status>{ Status.Married };
                case Context.Retired:
                    return new Collection<Status>{ Status.Single, Status.Divorced };
                case Context.Sick:
                    return new Collection<Status>{ Status.Widow};
                    return new Collection<Status>{ Status.Married, Status.Single, Status.Widow, Status.Divorced };


1 Reply

NK Neelakandan Kannan Syncfusion Team February 8, 2015 06:11 AM UTC

Hi Ramin,


Thank you for using Syncfusion products.


Here we have provided the sample as per your need. In the below sample if you change the datasource, the Combobox item will be changed dynamically as per Datasource. Please make use of below code,


Code Snippet:

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)


            if (e.TableCellIdentity.RowIndex > 2 && e.TableCellIdentity.Column!=null)


                if (defaultDatasource && e.TableCellIdentity.Column.Name=="Data1")


                    e.Style.CellType = GridCellTypeName.ComboBox;

                    e.Style.ChoiceList = defaultDatasourcelist;


                if(employeeDatasource && e.TableCellIdentity.Column.Name=="Data2")


                    e.Style.CellType = GridCellTypeName.ComboBox;

                    e.Style.ChoiceList = employeeDatasourcelist;





Please let me know if you have any concerns.




Attachment: GridGroupingControl_Demo_4aaf7eab.zip

Live Chat Icon For mobile
Up arrow icon