Thursday 29 August 2013

Telerik radgridview change row color based on value

  protected void gvUserDetail_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
           
            if (e.Item is GridDataItem)
            {
                //Get the instance of the right type
                GridDataItem dataBoundItem = e.Item as GridDataItem;
               

                //Check the formatting condition
                if ((dataBoundItem["column"].Text) == "Test")
                {
                    dataBoundItem["column"].ForeColor = Color.Green;
                    dataBoundItem["column"].Font.Bold = true;
                    e.Item.BackColor = Color.Red;
                    //Customize more...
                }
            }
          
        }


1 comment: