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

How to change the cell text color in the Grid at RunTime

How to change the cell''s text color in the Syncfusion''s Datagrid at run time if the cell is edited?

3 Replies

AD Administrator Syncfusion Team June 12, 2006 03:44 AM UTC

Hi Prashant, Try this code in PrepareViewStyleInfo event. Here is a code snippet GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; if(e.ColIndex > 0 && e.RowIndex > 0 ) { if( e.ColIndex == cc.ColIndex && e.RowIndex == cc.RowIndex && cc.IsEditing ) { e.Style.TextColor = Color.Red; } } Letme know if this helps. Best Regards, Haneef


PG Prashant Gangwar June 12, 2006 01:22 PM UTC

Hi Haneef, Thanks for your quick response. ForSCAGroupingDataGrid we do not have PrepareViewStyleInfo event. What can we use in place of that event? Thanks and Regards Prashant


AD Administrator Syncfusion Team June 13, 2006 04:16 AM UTC

Hi Prashant , For grouping grid, you need to use the TableControlPrepareViewStyleInfo event. Here is a code snippet private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlPrepareViewStyleInfoEventArgs e) { GridCurrentCell cc = e.TableControl.CurrentCell; if(e.Inner.ColIndex > 0 && e.Inner.RowIndex > 0 ) { if( e.Inner.ColIndex == cc.ColIndex && e.Inner.RowIndex == cc.RowIndex && cc.IsEditing ) { e.Inner.Style.TextColor = Color.Red; } } } Regards, Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon