about grid layout

2 posts, 1 answers
  1. Webster Velasco
    Webster Velasco avatar
    114 posts
    Member since:
    Jun 2012

    Posted 08 Mar 2010 Link to this post

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

    Posted 08 Mar 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top