I am trying to add style to a table row in C# code. However, as simple as it may seem, I caanot find the proper way to do it. The code for my table is
<table width="100%" style="vertical-align:top; height:170px;" border="0" cellspacing="0" cellpadding="0">
<tr id="trTasks" runat="server" onmouseover="this.bgColor='#eaeaea';" onmouseout="this.bgColor='#FFFFFF';" bgcolor="#FFFFFF"/>
</table>
I would like to set a different background color for trTasks when a condition is fullfiled. I’ve tried doing it like this:
trCompletedTasks.Attributes.Add("CssClass", "SelectedItem");
and
trCompletedTasks.Style.Add("CssClass", "SelectedItem");
but none of these seems to work.
Any suggestions would be much appreciated. Thank you very much.
The HTML attribute is named
class: