简体   繁体   中英

Setting a css class to HtmlInputCheckBox in C#

I am creating an HtmlInputCheckBox in C# and I am trying to set a css for it, but I cannot. Can anyone give me a sample code?
For example, the one below is not working.

HtmlInputCheckBox FieldCtrl = new HtmlInputCheckBox();
FieldCtrl.ID = "CheckBox1";
FieldCtrl.Style = "CheckBox";

.Net不会直接暴露许多普通的HTML属性,但您可以通过Attributes集合访问它。

FieldCtrl.Attributes["class"] = "MyCssClass";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM