|
//Event Subscription
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("CategoryID").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";
}
}
} |