This is a migrated thread and some comments may be shown as answers.

ComboBox Items HTML is just displaying tags

4 Answers 133 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jerk
Top achievements
Rank 1
Jerk asked on 19 May 2012, 10:22 PM
How can i get the ComboBox to display items with HTML tags properly? right now is just displays the tag rather then understanding it's HTML.

4 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 21 May 2012, 05:05 PM
Hi Jeremy,

Could you point out the code which does not behave as expected?

Greetings,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jerk
Top achievements
Rank 1
answered on 22 May 2012, 12:51 PM
Here is an example of what i'm trying to accomplish
<telerik:RadComboBox ID="RadComboBox1" Text="Please select your item:" runat="server">
<Items>
<telerik:RadComboBoxItem Value="1" Text="This should be <u>underlined</u>!" />
        <telerik:RadComboBoxItem Value="2" Text="This should be <b>bold</b>!" />
<telerik:RadComboBoxItem Value="3" Text="This should be &lt;u&gt;underlined&lt;/u&gt; also!" />
</Items>
</telerik:RadComboBox>
0
Jerk
Top achievements
Rank 1
answered on 22 May 2012, 05:33 PM
I've tried using the ItemTemplate as well, that will display it when the list is dropped down, but not in the selection box.
<telerik:RadComboBox ID="RadComboBox1" Text="Please select your item:" runat="server">
                   <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "Text") %>'></asp:Label>
                   </ItemTemplate>
                   <Items>
            <telerik:RadComboBoxItem Value="1" Text="This should be <u>underlined</u>!" />
                           <telerik:RadComboBoxItem Value="2" Text="This should be <b>bold</b>!" />
            <telerik:RadComboBoxItem Value="3" Text="This should be <u>underlined</u> also!" />
                   </Items>
                </telerik:RadComboBox>

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    Dim i As Integer = 0
    While i < RadComboBox1.Items.Count
        RadComboBox1.Items(i).DataBind()
        i = i + 1
    End While
 
End Sub
0
Ivana
Telerik team
answered on 25 May 2012, 11:53 AM
Hello Jeremy,

This is something related to the html input element itself. If you test  the following code you will notice that the content inside the input is also displayed as text instead of html so to prevent the page from malicious users.
<input type="text" runat="server" value="This should be <b>my bold</b>!" style="width: 300px;" />

Greetings,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Jerk
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Jerk
Top achievements
Rank 1
Share this question
or