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. Image for the cookie policy date
close icon

Grid Grouping row colour change on edit

Hi,
I want the color of a whole row to change when the user starts to edit the data in any cell. That is when they change the contents of a cell. Do you have any idea how I do that please?
Thanks
Paul

2 Replies

AD Administrator Syncfusion Team July 4, 2007 07:32 PM UTC

I think you can handle 3 events to get this behavior.


gridGroupingControl1.TableControlPrepareViewStyleInfo += new GridTableControlPrepareViewStyleInfoEventHandler(gridGroupingControl1_TableControlPrepareViewStyleInfo);
gridGroupingControl1.TableControlCurrentCellChanging += new GridTableControlCancelEventHandler(gridGroupingControl1_TableControlCurrentCellChanging);
gridGroupingControl1.TableControlCurrentCellMoved += new GridTableControlCurrentCellMovedEventHandler(gridGroupingControl1_TableControlCurrentCellMoved);



private int editingRow = -2;
void gridGroupingControl1_TableControlCurrentCellChanging(object sender, GridTableControlCancelEventArgs e)
{
editingRow = e.TableControl.GetNestedCurrentCell().RowIndex;
e.TableControl.RefreshRange(GridRangeInfo.Row(editingRow));
}

void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e)
{
if (editingRow != e.TableControl.GetNestedCurrentCell().RowIndex)
editingRow = -2;
}

void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
if (e.Inner.RowIndex == editingRow)
{
e.Inner.Style.BackColor = Color.Red;
}
}



PS Paul Sullivan July 5, 2007 08:36 AM UTC

Great, that works, thanks. I must say I've worked with grids where this kind of everyday requirement is a lot more intuitive to code. The paucity of the Syncfusion documentation is causing me to regularly have to resort to this forum for solutions to seemingly simple problems.

>I think you can handle 3 events to get this behavior.


gridGroupingControl1.TableControlPrepareViewStyleInfo += new GridTableControlPrepareViewStyleInfoEventHandler(gridGroupingControl1_TableControlPrepareViewStyleInfo);
gridGroupingControl1.TableControlCurrentCellChanging += new GridTableControlCancelEventHandler(gridGroupingControl1_TableControlCurrentCellChanging);
gridGroupingControl1.TableControlCurrentCellMoved += new GridTableControlCurrentCellMovedEventHandler(gridGroupingControl1_TableControlCurrentCellMoved);



private int editingRow = -2;
void gridGroupingControl1_TableControlCurrentCellChanging(object sender, GridTableControlCancelEventArgs e)
{
editingRow = e.TableControl.GetNestedCurrentCell().RowIndex;
e.TableControl.RefreshRange(GridRangeInfo.Row(editingRow));
}

void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e)
{
if (editingRow != e.TableControl.GetNestedCurrentCell().RowIndex)
editingRow = -2;
}

void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
if (e.Inner.RowIndex == editingRow)
{
e.Inner.Style.BackColor = Color.Red;
}
}


Loader.
Live Chat Icon For mobile
Up arrow icon