ASP.NET 1.x and 2.0 Application DesignApplication design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
The original poster asked "how do I make lbl.BackColor = "#F9DA00" work?"
In order to set a web control attribute that is of the System.Color type you need to provide it with such. In VB.net you do that with the function I suggested if you want to use a specific color vs. a predefined system color. Unfortunately, yes, this is a bit of a pain and somewhat complicated.
You couldn't do the hex conversion in your head? ;)
I agree that this is stupid. When you pick a color in the properties window you see a value of #FF8080. Why can't you just specify a color like that? I know it requies that you enter a value of System.Color, but if Microsoft suppplies you with a value like that, why can't you spcify a value like that in code? To me it is just another inconsistance of .NET. Any ideas why it works this way? I am curious as to why this is.