Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET: How to apply CSS class for a Table generated in C# codebehind

Tags:

c#

asp.net

I have an ASP.NET page and I am generating an HTML table in my server side code (codebehind file )as follows.

 HtmlTable iTblCart = new HtmlTable();
 HtmlTableRow iRowHeader = new HtmlTableRow();
 HtmlTableCell iCellHead1 = new HtmlTableCell();
 iCellHead1.InnerText= "Item";
 iRowHeader.Cells.Add(iCellHead1);
 iTblCart.Rows.Add(iCartRow);
 pnlPhoneCart.Controls.Add(iTblCart);  //appending to a panel

I want to apply a CSS class to this table.I could not find such a property from the intellisense.Am i missing anything ? Can anyone guide me how to go ahead ?

like image 659
Shyju Avatar asked May 30 '09 07:05

Shyju


1 Answers

Yes I got the answer.Here it is

iTblCart.Attributes.Add("Class", "clsTradeInCart");

and clsTradeInCart is my CSS class name

like image 71
Shyju Avatar answered Oct 21 '22 13:10

Shyju