I need to manipulate style properties of HTML elements based on a condition. So this should be simply done from code behind. Setting style for \[code\]element text - font family\[/code\] is one of the tasks that's required in many cases. For instance, setting a \[code\]<td>\[/code\] style font-family would look like:\[code\]tdId.style.add("font-family", FontFamilies.Families[index#]);\[/code\]But this way I have to guess which one is \[code\]arial\[/code\] or \[code\]david\[/code\].I wanted to avoid use of strings as values that will easier and also less typo prone. Is there any way to avoid this code I have made to achieve? \[code\]tdId.style.add("font-family", FontFamilies.Family.Arial);tdId.style.add("font-family", CustumFontClass.Arial);\[/code\]This code is only way I could think of making a FontClass of my own. Could I avoid this in any other way?\[code\]public bool Class = true;public bool ExampleTable = false;protected void doStuff(object sender, ImageClickEventArgs e){ CreateFonts(Class); //CreateFonts(ExampleTable);}//method to Create a Sealed Class With fonts as Const stringsprivate void CreateFonts(bool CreatePageAs){ System.Drawing.FontFamily[] MyFonts = System.Drawing.FontFamily.Families; int TotalFonts = MyFonts.Length; int tableBorder = 0; string tdOpn = "<td>", tdClos = "</td>"; string trOpn = "<tr>", trClos = "</tr>"; string nl = Environment.NewLine; string tab = "\t"; string endOfLine = ","; string SldCls_declaration = string.Concat("public sealed class fntNams",tdClos,nl,tab,trClos,nl,tab,tdOpn,tab,tab,"{"); string fontAsVariable = string.Empty, Consts_declaration = "public const string "; string Line ="", firstLine, RestOfLine="", LastLine, tdinExampleTable; foreach (System.Drawing.FontFamily font in MyFonts) { if (CreatePageAs.Equals(ExampleTable)) { tdinExampleTable = string.Concat("<td style=\"font-family: ", font.Name, "\">"); tdOpn = tdinExampleTable; tableBorder = 5; } fontAsVariable = font.Name.Replace(" ", "").Replace("-", "_"); fontAsVariable = string.Concat(tab, fontAsVariable); if (font.Equals(MyFonts[0])) { firstLine = string.Concat("<table border=\"", tableBorder, "\">", nl, tab, trOpn, nl, tab, tab, tdOpn, nl, tab, tab, tab, SldCls_declaration, nl, tab, tab, tdClos, nl, tab, trClos, trOpn, tdOpn, Consts_declaration, fontAsVariable, " = \"", font.Name, "\",", nl, tab, tab, tdClos, nl, tab, trClos); Line = firstLine; } else if (font.Equals(MyFonts[TotalFonts - 1])) { LastLine = string.Concat(nl, tab, trOpn, nl, tab, tab, tdOpn, nl, tab, tab, tab, fontAsVariable, " = \"", font.Name, "\";",nl,tab,tab,tdClos,nl,tab,trClos, nl,trOpn,nl,tab, tab,tdOpn,tab,tab,nl,tab,tab,tab,"}", nl, tab, tab, tdClos, nl, tab, trClos, nl, "</table>"); Line = LastLine; } else if (!font.Equals(MyFonts[TotalFonts-1]) && !font.Equals(MyFonts[0])) { RestOfLine = string.Concat(nl, tab, trOpn, nl, tab, tab, tdOpn, nl, tab, tab, tab, fontAsVariable, " = \"", font.Name, "\"", endOfLine, nl, tab, tab, tdClos, nl, tab, trClos); Line = RestOfLine; } Response.Write(Line); }}\[/code\]I execute this by binding it to \[code\]OnClick\[/code\] event of a button:\[code\]<asp:ImageButton ID="ImgBut_CreateFontsClass" runat="server" ImageUrl="~/images/AnIcon.png" OnClick="doStuff" />\[/code\]This will generate a "Class" I was looking for. Then just collect result from the generated page itself (Copy Paste) to Visual studio Code Behind as a new class.