10

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 ?

1 Answer 1

22

Yes I got the answer.Here it is

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

and clsTradeInCart is my CSS class name

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.