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>

私がやりたいのは、個人企業だけに下線を引くことです。

次のようなことを試しましたが、うまくいきませんでした:

    <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 に答える