Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I apply a CSS class to HtmlTableCell?

Tags:

c#

webforms

I'm working with WebForms. HtmlTableCell does not have a CssClass property. I can do this:

<td class="whatever"></td>

But not this:

myTableCell.Class = "whatever";

How can I apply a CSS class to my HtmlTableCell?

like image 957
Jaco Pretorius Avatar asked Nov 17 '10 07:11

Jaco Pretorius


2 Answers

Got it.

myTableCell.Attributes.Add("class", "whatever");
like image 155
Jaco Pretorius Avatar answered Nov 01 '22 15:11

Jaco Pretorius


Attributes property works too for CSS style.

For example:

myTableCell.Attributes.Add("style", "height: 30px; border: 1px solid;")
like image 44
Eduardo Pelais Avatar answered Nov 01 '22 15:11

Eduardo Pelais