We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

disable combobox embedded in cell

Thread ID:

Created:

Updated:

Platform:

Replies:

69009 Oct 9,2007 03:07 PM Oct 10,2007 11:51 AM Windows Forms 1
loading
Tags: GridControl
Ashes Mukherjee
Asked On October 9, 2007 03:07 PM

I have a GridDataBoundGrid where certain columns hold combobox controls. On checking/unchecking of a checkbox cell (on the same row), I would like to enable/disable this combobox control.



haneefm [Syncfusion]
Replied On October 10, 2007 11:51 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;