2013-04-15 2 views
0

У меня есть следующий -ASP.NET ListItem Text моделирование

<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

Проверить этот вопрос: http://stackoverflow.com/questions/8123757/how-to-add-tooltip-for-checkboxlist-for-each-item-in-asp-net Вы можете использовать такой же подход, чтобы добавить атрибут класса в ListItems в зависимости от значения –

+0

, для чего стоит подчеркнуть текстовые столкновения с обычными гиперссылками (которые также подчеркнуты), рассмотреть жирный или курсивный стиль в качестве альтернативы. – MikeM

ответ

3

Вам нужна отдельная цитата - '.

enter image description here

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

Вы можете использовать HTML в значении текста для ListItems:

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

Текст можно добавить вне атрибута Текст:

<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> 
Смежные вопросы