Monday, October 19, 2009
Simple utility code syntax for converting System.Drawing.Color to HTML color
Runtime whenever you are trying to access color, it is easy to assign known colors, but if you want to assign HTML Color name runtime you can use ColorTranslator.FromHtml method instead of Color.KnownColor name.
tdRecord.BackColor = System.Drawing.Color.Yellow;
tdRecord.BackColor = System.Drawing.ColorTranslator.FromHtml("#ecf5f8");