I have a RadioButtonList
that is being rendered as an Unordered list. My issue is I am adding a class to the ListItem
and it is creating a span
in which the class is being placed. Is there a way I can have the class placed on the LI
tag instead? How can I go about it?
var cblAttributes = new RadioButtonList();
cblAttributes.ID = controlId;
cblAttributes.RepeatLayout = RepeatLayout.UnorderedList;
var pvaValueItem = new ListItem(Server.HtmlEncode(frame.Name), frame.FrameId.ToString());
pvaValueItem.Attributes.Add("class", "frame-item");
cblAttributes.Items.Add(pvaValueItem);
Output is below:
<li>
<span class="frame-item">
<input id="INPUTID" type="radio" name="INPUTNAME" value="1">
<label for="INPUTID">TEXT</label>
</span>
</li>
You can create new css class like ul.frame-items li { frame-item class definition here }
and apply frame-items class on the RadioButtonList via the CssClass property
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With