I'm building a HTML table from a C# typed list. So far building the table works fine, but I now need to append a style to one of the <TD>
tags within the string that builds the table.
What I have tried is simply adding the style definition to the TD
when appended to the string using string builder. But I get syntax errors using around the style definition.
Question: How can you append a style definition to tag within a string?
I create the table body using String Builder string instance:
StringBuilder releaseStatusTableBodyData = new StringBuilder();
Then add a row and col to the table string. Removing the double quotes from the style didn't remove the syntax error shown either:
foreach(var row in releaseStatusList)
{
//for each record create a new table row
releaseStatusTableBodyData.Append("<TR>\n");
releaseStatusTableBodyData.Append("<TD style=""bgcolor: green;"">"); //added the style to the TD here, but get syntax error on the style telling me ) is required.
releaseStatusTableBodyData.Append(row.Days_Owned);
releaseStatusTableBodyData.Append("</TD>");
releaseStatusTableBodyData.Append("</TR>\n"); //end of row
}