I want to set the DataGrid's header background color to #6b8ec6 but I could not find any method that allows me to do that on the following statements for example: dg.HeaderStyle.BackColor = Color.SteelBlue; dg.HeaderStyle.ForeColor = Color.White; This one comes
close but not sure what to pass in. Color.FromArgb() 'Thanks for any help.
Hi, You can use the ColorTranslator come with the System.Drawing class E.g. Label1.BackColor = System.Drawing.ColorTranslator.FromHtml("#F9DA00") Regards,
It seem that System.Drawing.ColorTranslator.FromHtml() only works with named colors ("red","green", ...) but not with hex values. Is there a way to accept all formats and correctly transform to Color?
I'm calling and aspx page with a color param. I need this color to be passed on the querystring, so I call the aspx as: somepage.aspx?color=#FFFFFF&.... and I get "Input string was not in a correct format". I think here the problem is the # symbol. Is there
a problem passing # as a parameter? If I write somepage.aspx?color=FFFFFF I get
FormatException: Input string was not in a correct format.]
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +0
System.ComponentModel.Int32Converter.FromString(String value, NumberFormatInfo formatInfo) +37
System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) +382
[Exception: FFFFFF is not a valid value for Int32.]
System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) +413
System.ComponentModel.TypeConverter.ConvertFromString(ITypeDescriptorContext context, CultureInfo culture, String text) +12
System.Drawing.ColorConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) +984
System.ComponentModel.TypeConverter.ConvertFromString(String text) +9
System.Drawing.ColorTranslator.FromHtml(String htmlColor) +572
VMasanas.DNN.Modules.InfoMap.MapProcess.getMap(Boolean showGrid, Boolean showHotspots) +133
VMasanas.DNN.Modules.InfoMap.getMap.Page_Load(Object sender, EventArgs e) +250
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
spatemp
Member
170 Points
64 Posts
How do you set the color using hex value #6b8ec6 or the RGB
Jan 20, 2004 12:41 PM|LINK
Colt
All-Star
15569 Points
1986 Posts
ASPInsiders
MVP
Re: How do you set the color using hex value #6b8ec6 or the RGB
Jan 20, 2004 12:42 PM|LINK
Charley Bogw...
Participant
1880 Points
374 Posts
Re: How do you set the color using hex value #6b8ec6 or the RGB
Jan 22, 2004 10:14 PM|LINK
vmasanas
Star
7685 Points
1550 Posts
Re: How do you set the color using hex value #6b8ec6 or the RGB
May 10, 2004 02:07 PM|LINK
Charley Bogw...
Participant
1880 Points
374 Posts
Re: How do you set the color using hex value #6b8ec6 or the RGB
May 10, 2004 02:37 PM|LINK
vmasanas
Star
7685 Points
1550 Posts
Re: How do you set the color using hex value #6b8ec6 or the RGB
May 10, 2004 09:45 PM|LINK
Vimpyboy
Contributor
3212 Points
651 Posts
MVP
Re: How do you set the color using hex value #6b8ec6 or the RGB
May 16, 2004 09:20 PM|LINK
System.Drawing.ColorTranslator.FromHtml("#" & Request.Querystring("color"))http://weblogs.asp.net/mikaelsoderstrom
http://www.twitter.com/vimpyboy
kjshaju
Member
131 Points
80 Posts
Re: How do you set the color using hex value #6b8ec6 or the RGB
Aug 18, 2011 12:49 PM|LINK
System.Drawing.ColorTranslator.FromHtml("#6b8ec6")