How to set a CSSClass for a dynamically generated label?

如何使用C#在asp.net中为动态生成的标签设置CSSClass


Label lbl = new Label();
lbl.Text = "Hello World!";
lbl.CssClass = "red_and_bold";

When You create Label then set its CssClass property:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.cssclass.aspx


If you mean setting it server-side you can use WebControl.CssClass property:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.cssclass.aspx

链接地址: http://www.djcxy.com/p/45918.html

上一篇: 匹配多行perl正则表达式

下一篇: 如何为动态生成的标签设置CSSClass?