开发者

Add Classes to LI in ASP.NET RadioButtonList

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?

开发者_如何学C
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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜