2013-04-15 39 views
0

我有以下幾點 -ASP.NET ListItem的文本樣式

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