HA
haneefm
Syncfusion Team
October 10, 2007 03:51 PM UTC
Hi Ashes,
Below are the codes which demonstrates a way to change the appearance of the combobox cell in grid. For this, you can handle the PrepareViewStyleInfo event and set the Enabled and Clickable property to checkbox's cellvalue.
void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridDataBoundGrid _grid = sender as GridDataBoundGrid;
int _targetColIndex = _grid.NameToColIndex("Col2");
if (e.RowIndex > 0 && e.ColIndex == _targetColIndex)
{
int _checkColIndex = _grid.NameToColIndex("CheckBox");
bool _checkBoxValue = Convert.ToBoolean(_grid.Model[e.RowIndex, _checkColIndex].CellValue);
e.Style.Enabled = _checkBoxValue;
e.Style.Clickable = _checkBoxValue;
}
}
private void gridDataBoundGrid1_CurrentCellChanged(object sender, System.EventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if(cc.Renderer.StyleInfo.CellType == "CheckBox")
{
this.gridDataBoundGrid1.CurrentCell.ConfirmChanges();
this.gridDataBoundGrid1.RefreshRange(GridRangeInfo.Row(cc.RowIndex));
}
}
Best regards,
Haneef