0

我有以下 -

    <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>

我喜欢做的是强调PersonalEnterprise

我尝试了类似以下的方法,但没有奏效:

    <asp:ListItem Text= <span class="underline"> Individual </span>-....

正如我得到的:

    Error   71  The 'Text' property of 'asp:ListItem' does not allow child objects.
4

3 回答 3

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>
于 2013-04-15T14:51:52.673 回答
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>
于 2013-04-15T14:50:07.230 回答
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>
于 2013-04-15T14:47:11.497 回答