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

Change the forecolor of row

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryann
Top achievements
Rank 1
Ryann asked on 17 Oct 2013, 10:10 AM

Hi,

How to change the forecolor of a row depending on a column value?

Thanks,
Ryann.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 17 Oct 2013, 10:16 AM
Hi Ryann,

Please try the following code snippet to change the fore-color of a row,based on a value of column.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
  {
    if (e.Item is GridDataItem)
      {
        GridDataItem item = (GridDataItem)e.Item;
         if (item["ColumnUniqueName"].Text == "Your Text")
         {
          item.ForeColor = System.Drawing.Color.Red;
         }          
      }
  }

Thanks,
Princy
Tags
Grid
Asked by
Ryann
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or