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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Grouping row colour change on edit

Thread ID:

Created:

Updated:

Platform:

Replies:

63479 Jul 4,2007 02:30 PM UTC Jul 5,2007 08:36 AM UTC WinForms 2
loading
Tags: Grouping
Paul Sullivan
Asked On July 4, 2007 02:30 PM UTC

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

Administrator [Syncfusion]
Replied On 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;
}
}


Paul Sullivan
Replied On 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;
}
}


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;