I am trying to set the backcolor of a gridview GridViewCommandColumn using conditional formating, but it is not showing the colors:
I am using gridview version 2011.1.11.419
Please help
Thanks
Here is the code:
void radGV_CellFormatting(object sender, CellFormattingEventArgs e)
{
if (mycondn == true) { e.CellElement.DrawFill = true; e.CellElement.ForeColor = Color.Blue; e.CellElement.NumberOfColors = 1; e.CellElement.BackColor = System.Drawing.Color.Gold; } else { e.CellElement.DrawFill = true; e.CellElement.ForeColor = Color.Blue; e.CellElement.NumberOfColors = 1; e.CellElement.BackColor = System.Drawing.Color.LightBlue; }
}my cell is created like this:
//data base field name is ScDate GridViewCommandColumn colSchDelDate = new GridViewCommandColumn("ScDate"); colSchDelDate.UseDefaultText = false; colSchDelDate.Width = 80; colSchDelDate.HeaderText = "Sc Date"; colSchDelDate.ReadOnly = true; colSchDelDate.FormatString = "{0:MM/dd/yy}"; colSchDelDate.TextAlignment = ContentAlignment.MiddleCenter; radGV.MasterTemplate.Columns.Add(colSchDelDate);}