Hi Marco,
Thanks for contacting Syncfusion support.
We have analyzed your query and suspect that you are trying to change the data source for a ComboBox column based on another ComboBox value. As per our current architecture, the GridGroupingControl does not have direct support to change a column’s data source based on another column. This can be achieved by some workaround using the QueryCellStyleInfo event. In that event, the data source for a column can be set based on value of another ComboBox of the record and the cell value of another ComboBox column can be retrieved by using GetValue() method of Record. . We have created a simple sample as per your requirement. In the provided sample, the value of “SampleData” column can be modified based on the value the “CategoryID” column. Please refer to the below code and sample,
Code example
|
//Event subscription
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo;
//Event Customization
private void GridGroupingControl1_QueryCellStyleInfo(object sender,GridTableCellStyleInfoEventArgs e)
{
var style = e.Style as GridTableCellStyleInfo;
if (style.TableCellIdentity == null || style.TableCellIdentity.Column == null)
return;
if (style.TableCellIdentity.Column.Name == "SampleData")
{
Element el = style.TableCellIdentity.DisplayElement;
if (el != null && el.Kind == DisplayElementKind.Record)
{
Record record = el.GetRecord();
//Get the first column cell value
String value = record.GetValue("State").ToString();
//Get the collection based on the first column value
List<CasCading> source = comboSource[value];
//Assign the collection for second column.
e.Style.DataSource = source;
e.Style.DisplayMember = "SData";
}
}
} |
Note
Please let us know your exact requirement with simple screenshot/video if we misunderstood anything from your requirement.
Regards,
Arulpriya