Hi GKrish,
The DataSource for a specific cell can also be changed dynamically by handling the Model.QueryCellInfo event. Querying the style info of a cell using grid[rowindex, colindex].text in the QueryCellInfo will fire the event again and will lead to a recursive call. We can set a flag in the ClosedCellDropDown when a particular value is selected and assign the datasource only when the flag is set. In the attached sample choose the value "One" in cell 2,2 to change the DataSource for a ComboBox in the Cell 3,3.
private void gridModel_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if(e.ColIndex == 3 && e.RowIndex == 3)
{
e.Style.CellType = "ComboBox";
e.Style.ChoiceList = null;
}
if(e.ColIndex == 3 && e.RowIndex == 3 && flag)
{
StringCollection items = new StringCollection();
items.Add("A");
items.Add("B");
items.Add("C");
items.Add("D");
items.Add("E");
e.Style.ChoiceList = items;
}
}
private bool flag = false;
private void gridDataBoundGrid1_CurrentCellCloseDropDown(object sender,
Syncfusion.Windows.Forms.PopupClosedEventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if(cc.ColIndex == 2 && cc.RowIndex == 2)
{
flag = false;
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
if (cr.ControlText == "One")
{
flag = true;
}
else
flag = false;
}
}
Please refer the sample in the below link that illustrates the above.
http://websamples.syncfusion.com/samples/Grid.Windows/F73330B/main.htmYou can also refer the following forum thread that discus about this.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=42073Please let me know if this helps.
Regards,
Asem.