我有以下内容 -
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Vertical" RepeatLayout="Table" CssClass="RBL" TextAlign="Right">
<asp:ListItem Text= "Individual - This is for user" />
<asp:ListItem Text="Enterprise - This is for enterprises" />
</asp:RadioButtonList>
我喜欢的是强调个人和企业。
我尝试了类似下面的内容,但没有奏效:
<asp:ListItem Text= <span class="underline"> Individual </span>-....
我得到了:
Error 71 The 'Text' property of 'asp:ListItem' does not allow child objects.
答案 0 :(得分:3)
你想要单引号 - '。
<style type="text/css">
.underline { text-decoration: underline; }
</style>
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
RepeatDirection="Vertical" RepeatLayout="Table" CssClass="RBL" TextAlign="Right">
<asp:ListItem Text="<span class='underline'>Individual</span> - This is for user" />
<asp:ListItem Text="<span class='underline'>Enterprise</span> - This is for enterprises" />
</asp:RadioButtonList>
答案 1 :(得分:1)
您可以在Text属性之外添加文字:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Vertical" RepeatLayout="Table" CssClass="RBL" TextAlign="Right">
<asp:ListItem> <span class="underline">Individual</span> - This is for user </asp:ListItem>
<asp:ListItem> <span class="underline">Enterprise</span> - This is for enterprises </asp:ListItem>
</asp:RadioButtonList>
答案 2 :(得分:0)
您可以在ListItems的Text值中使用HTML:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Vertical" RepeatLayout="Table" CssClass="RBL" TextAlign="Right">
<asp:ListItem Text= "<u>Individual</u> - This is for user" />
<asp:ListItem Text= "<u>Enterprise</u> - This is for enterprises" />
</asp:RadioButtonList>