0
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>
我可以一個的CssClass添加到自動生成的<label>
標籤?
是的,謝謝,這是我可能提出的想法,但設計師可以如此挑剔:D – inspite