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.
精彩评论