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

Conditional Formatting

Thread ID:





53908 Dec 22,2006 10:49 AM UTC Dec 22,2006 11:06 AM UTC WinForms 1
Tags: GridControl
Asked On December 22, 2006 10:49 AM UTC


Is there any conditional formatting available in DataBoundGrid like if value of a particular cell is greater than 25 then the background color would be blue (any color i can define on run-time)

Administrator [Syncfusion]
Replied On December 22, 2006 11:06 AM UTC

Hi Ubaid,

To set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check e.RowIndex and e.ColIndex, and if these point to the cell you want to change, you set e.Style.BackColor to the value you want. Below is a code snippet to change backcolor to Color.Red when the Text having the number greater than 25.

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
if( e.Style.Text != null && e.Style.Text != string.Empty
&& e.Style.CellValueType == typeof(int))
int number = int.Parse(e.Style.Text);
if( number > 25)
e.Style.BackColor = Color.AliceBlue ;

Best Regards,


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

This page will automatically be redirected to the 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