我有一个RadioButtonList
正在呈现为无序列表。我的问题是我正在向ListItem
添加一个类,它正在创建一个放置类的span
。有没有办法让课程放在LI
标签上?我该怎么办呢?
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);
输出如下:
<li>
<span class="frame-item">
<input id="INPUTID" type="radio" name="INPUTNAME" value="1">
<label for="INPUTID">TEXT</label>
</span>
</li>
答案 0 :(得分:2)
您可以创建新的css类,如ul.frame-items li { frame-item class definition here }
,并通过CssClass属性在RadioButtonList上应用frame-items类