Rank: Newbie Groups: Member
Joined: 10/6/2011 Posts: 8
|
I need to set the background color of cells in the VB code behind. What I have below sets the entire column, but I don't see where to do just the 1 cell -
Select Case Trim(SearchText) Case "Preflight C" gridrow.Cells(5).Column.CellStyle.BackColor = Color.AliceBlue Case "Assigned to" gridrow.Cells(5).Column.CellStyle.BackColor = Color.Aqua Case "Out for Pro" gridrow.Cells(5).Column.CellStyle.BackColor = Color.Bisque Case "Proof Appro" gridrow.Cells(5).Column.CellStyle.BackColor = Color.Chartreuse Case "Order to Pr" gridrow.Cells(5).Column.CellStyle.BackColor = Color.Coral Case "Line Item t" gridrow.Cells(5).Column.CellStyle.BackColor = Color.Coral Case "Material Pr" gridrow.Cells(5).Column.CellStyle.BackColor = Color.CornflowerBlue Case "Ink Prep Co" gridrow.Cells(5).Column.CellStyle.BackColor = Color.DarkGoldenrod Case "Screen Prep" gridrow.Cells(5).Column.CellStyle.BackColor = Color.DarkSeaGreen Case "Printing Co" gridrow.Cells(5).Column.CellStyle.BackColor = Color.DeepPink Case "Finishing C" gridrow.Cells(5).Column.CellStyle.BackColor = Color.Gold Case "Digital Fin" gridrow.Cells(5).Column.CellStyle.BackColor = Color.LightBlue Case "Installatio" gridrow.Cells(5).Column.CellStyle.BackColor = Color.MediumPurple Case "Packing Com" gridrow.Cells(5).Column.CellStyle.BackColor = Color.OliveDrab Case "Job Shipped", "Job Deliver", "Ready for C", "Put Into In" gridrow.Cells(5).Column.CellStyle.BackColor = Color.ForestGreen Case Else End Select
THANKS,
Wes
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, You can use StyleField property to do that. See here for an working example: http://demo.essentialobjects.com/Demos/Grid/Features/Conditional%20Formatting%20-%20Cell%20Based/Demo.aspxYou can take a look of the "Remark" section to see how this feature works. Thanks!
|