这
protected void Page_Load(object sender, EventArgs e) {
RadioButtonList1.Items.Add(new ListItem("London","1"));
RadioButtonList1.Items.Add(new ListItem("Paris", "2"));
}
还有这个
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatLayout="Flow">
</asp:RadioButtonList></div>
生成类似这样的 HTML
<input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="1" />
<label for="RadioButtonList1_0">London</label>
<input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="2" />
<label for="RadioButtonList1_1">Paris</label>
但我真正想要的是这个,注意<label>
标签中的类。
<input type="radio" name="Event" id="whatever" value="1" />
<label for="London" class="London">London</label>
<input type="radio" name="Event" id="whatever" value="2" />
<label for="Paris" class="Paris">Paris</label>
我可以在自动生成的<label>
标签中添加一个 cssClass 吗?