开发者

Is there a possibility to assign CssClass to CheckBox within CheckBoxList

开发者 https://www.devze.com 2023-01-25 15:00 出处:网络
I need to assign display style (CssClass) to every CheckBox within CheckBoxList. I would 开发者_开发技巧like to do it separately for every CheckBox.

I need to assign display style (CssClass) to every CheckBox within CheckBoxList. I would 开发者_开发技巧like to do it separately for every CheckBox. And the last requirement is that I have to do it on server side within my .net code.


Not explicitly. You can use Attributes:

ListItem myItem = CheckBoxList1.Items[itemIndex];
myItem.Attributes["bgcolor"] = "lightblue";

As far as having each checkbox use CssClass, each CheckBox is actually a ListItem and that class does not support CssClass.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号