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

about grid layout

1 Answer 20 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Webster Velasco
Top achievements
Rank 2
Webster Velasco asked on 08 Mar 2010, 10:11 AM
hi

how can i change the row background colour depends on a column value

e.g.

DTDIFF <= 30days Row BGCOLOR = RED


thanks in advance

regards
webster

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 08 Mar 2010, 12:26 PM
Hi,

Try the code snippet below to achieve the desired result:

C#
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridDataItem)  
        {  
         GridDataItem dataItem = (GridDataItem )e.Item;  
         int DateDiff=  Convert.ToInt32(dataItem["DateDiff"].Text); 
         if (DateDiff > 30)  
         {  
             dataItem.BackColor = Drawing.Color.Red;  
         }  
     }  

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