Hi Tod,
One way you can avoid this problem by deriving the GridComboBoxCellRenderer class and override the OnSaveChanges method. Here is a code snippet to show this.
public class MyComboBoxCellModel : GridComboBoxCellModel
{
public MyComboBoxCellModel(GridModel grid): base(grid)
{ }
public override GridCellRendererBase CreateRenderer(GridControlBase control)
{
return new MyComboBoxCellRenderer(control, this);
}
}
public class MyComboBoxCellRenderer : GridComboBoxCellRenderer
{
public MyComboBoxCellRenderer(GridControlBase grid, GridCellModelBase cellModel) : base(grid, cellModel)
{ this.SupportsFocusControl = false; }
protected override bool OnSaveChanges()
{
Type type = this.Grid.Model[this.RowIndex,this.ColIndex].CellValue.GetType();
if (type == this.ControlValue.GetType())
return base.OnSaveChanges();
else
{
Customer cust = new Customer();
cust.ID = (this.ControlValue as GoodCustomer).ID;
cust.First = (this.ControlValue as GoodCustomer).First;
cust.Last = (this.ControlValue as GoodCustomer).Last;
this.Grid.Model[this.RowIndex, this.ColIndex].CellValue = cust;
}
return true;
}
}
Here is a modified sample.
http://websamples.syncfusion.com/samples/Grid.Windows/F61685/main.htmBest regards,
Haneef