How to conditonally paint a row background color

3 posts, 0 answers
  1. Joseph
    Joseph avatar
    1 posts
    Member since:
    Jan 2013

    Posted 13 Jan 2013 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Jan 2013 Link to this post

    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.
  3. Plamen
    Admin
    Plamen avatar
    132 posts

    Posted 17 Jan 2013 Link to this post

    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.
Back to Top