ASP.Net - Color

Here are some samples

Early versions of Visual Basic ASP.Net forms provided a backColor and foreColore attributes.

While these work, the recommended method is to use control styles, and place those styles within a CSS page.

In any case, here is how you used to do coloring in ASP.Net

1
2
e.Cell.BackColor = System.Drawing.Color.Linen
e.Cell.ForeColor = System.Drawing.Color.Black

Here’s how to assign a color from a number

1
2
3
Dim Color(4) As System.Drawing.Color
Color(1) = System.Drawing.Color.FromArgb(&HDCD5B8;)
albl.BackColor = Color(x)

Here’s how to set the color from a string variable

1
e.Cell.BackColor = System.Drawing.Color.FromName("Yellow")