I have an ASP.NET page and I am generating an HTML table in my server side code (codebehind file )as follows.
我有一个ASP.NET页面,我在我的服务器端代码(代码隐藏文件)中生成一个HTML表,如下所示。
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 ?
我想将CSS类应用于此表。我无法从intellisense中找到这样的属性。我错过了什么?任何人都可以指导我如何继续吗?
1 个解决方案
#1
20
Yes I got the answer.Here it is
是的我得到了答案。就是这样
iTblCart.Attributes.Add("Class", "clsTradeInCart");
and clsTradeInCart is my CSS class name
和clsTradeInCart是我的CSS类名
#1
20
Yes I got the answer.Here it is
是的我得到了答案。就是这样
iTblCart.Attributes.Add("Class", "clsTradeInCart");
and clsTradeInCart is my CSS class name
和clsTradeInCart是我的CSS类名