Event on ValueChanged on DataSource GridDataBoundGrid

Hi all,
There is in the GridDataBoundGrid an event that is triggered when the value of an object in the dataSource is changed ?
My goal is to change the background color of a cell when the correspondent value in the dataSource is changed. The change to the dataSource are not made by the user interacting with the grid, so events like valueChanged and TextChanged are not triggered. How can I do this?



1 Reply

SR SubhaSheela R Syncfusion Team May 13, 2008 11:34 AM UTC


Hi ML,

Thank you for using Syncfusion products.

You can achieve the desired behavior by calling CurrentCell.EndEdit() and Binder.EndEdit() methods of GridDataBoundGrid Control. By handling the PrepareViewStyleInfo event, you can set the back color of that particular row. Below is the code snippet:


this.gridDataBoundGrid1.CurrentCell.EndEdit();
this.gridDataBoundGrid1.Binder.EndEdit();
this.gridDataBoundGrid1.PrepareViewStyleInfo += new Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventHandler(gridDataBoundGrid1_PrepareViewStyleInfo);

void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if (this.gridDataBoundGrid1.CurrentCell.ConfirmChanges(true))
{
e.Style.BackColor = Color.HotPink;
}
}


Here is the sample:

'>http://websamples.syncfusion.com/samples/Grid.Windows/Grid_WF_GDBGDataSourceModification_F73293/main.htm">


Please have a look into the above sample and let me know if it helps.

Regards,
Subhasheela R




Loader.
Up arrow icon