Hi haneef,
thanx for the example. i did that but the usage TableControlPrepareViewStyleInfo is just too costly it seems that grid takes lot of time to repaint . as i am disabling
cells based on other cells value.
Also in the drop down some times the TableControlCurrentCellChanged event is caught but some times the event is not caught.
can i do this in TableControlCurrentCellChanged only.
>Hi Pawan,
Here is a minimal sample that shows you how to set the style property of the cell such as Enabled,Clikable,BackColor and etc,.depends on the another cell value in a same row. It implements the TableControlPrepareViewStyleInfo event to change the Enabled/BackColor property of the cell by checking the EmpName is equal to "Hazart" in a "Salary" column cell. Here is a code snippet
private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo info = e.Inner.Style as GridTableCellStyleInfo;
Element el = info.TableCellIdentity.DisplayElement;
if( el != null && el.Kind == DisplayElementKind.Record)
{
GridRecordRow row = el as GridRecordRow;
if( row != null && row.ParentRecord != null && info.TableCellIdentity.Column != null )
{
//Disable the Salary Column depends on the value present the EmpName column.
//Check the Cell value depends on the "Salary" Column...
if( info.TableCellIdentity.Column.Name == "Salary")
{
//Access the "EmpName" cell value.
object obj = row.ParentRecord.GetValue("EmpName");
if( obj != null && obj.ToString() == "Hazart")
{
e.Inner.Style.Enabled = false;
e.Inner.Style.Clickable = false;
e.Inner.Style.BackColor = SystemColors.Control;
}
}
}
}
}
Please refer to the attached sample for implementation.
GGCCellEnabledProperty.zipBest Regards,
Haneef