This is a migrated thread and some comments may be shown as answers.

How to conditonally paint a row background color

2 Answers 259 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 13 Jan 2013, 07:46 PM
I need to have a button on a form that  when clicked -  iterate through all rows of the RADGridview and change some of the rows background color according to some criteria.
All of the samples suggest using 'RowFormatting' event, but it doesn't sound applicable here.

So if my code looks like:

foreach (GridViewRowInfo rowInfo in grdOrderlinesBase.Rows)

{
...
}

How do I make the background of the row corresponding to the i'th rowInfo become red?

Thanks

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Jan 2013, 07:00 AM
Hi Joseph,

In order to change row color based on cell value you can use the RadGridView formatting events.

A second option is to use conditional formatting. You can read about this method in this help article.

Hope this helps.

Regards,
Princy.
0
Plamen
Telerik team
answered on 17 Jan 2013, 07:07 AM
Hi guys,

Thank you for writing.

I can confirm that the approaches suggested by Princy are the right way to go. 

@Princy. Thank you for your community effort. Your Telerik points have been updated for your time and efforts.
 
I hope you find my information useful.

All the best,
Plamen
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
GridView
Asked by
Joseph
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Plamen
Telerik team
Share this question
or