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

Using HTML entities in the text of a RadComboBoxItem control

3 Answers 200 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 19 Mar 2011, 12:42 AM
I'm trying to pad the text of a RadComboBoxItem with spaces (to create a sense of hierarchy).  This works fine with a regular HTML select control:

<select>
    <option>Item 1</option>
    <option>&nbsp;&nbsp;Item 1.1</option>
    <option>&nbsp;&nbsp;Item 1.2</option>
    <option>Item 2</option>
    <option>&nbsp;&nbsp;Item 2.1</option>
    <option>&nbsp;&nbsp;&nbsp;&nbsp;Item 2.1.1</option>
    <option>&nbsp;&nbsp;&nbsp;&nbsp;Item 2.1.2</option>
    <option>Item 3</option>
    <option>&nbsp;&nbsp;Item 3.1</option>
    <option>&nbsp;&nbsp;Item 3.2</option>
</select>

However, when I try to set the text property of a RadComboBoxItem using html entities (&nbsp;), the control seems to be escaping the characters so it shows up exactly as typed instead of showing up as an actual space:item.Text = padding + asset.AssetName;

string padding = "";
for(int i = 0; i < depth; i++)
    padding += " ";
RadComboBoxItem item = new RadComboBoxItem();
item.Value = asset.AssetID.ToString();
item.Text = padding + asset.AssetName;
item.Enabled = (asset.Type == AssetType.AppSet);
item.Selected = (asset.AssetID == ParentAssetID);
rcb.Items.Add(item);

Any ideas about how to prevent the RadComboBox from escaping HTML entities?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Mar 2011, 06:18 AM
Hello Tervor,

Take a look at the following forum post which discussed similar scenario.
Problem During Rendering of HTML Tag text on Rad Combobox

Thanks,
Shinu.
0
Sandeep
Top achievements
Rank 1
answered on 31 Dec 2014, 04:31 AM
Hi
I also have similar problem with rad combobox . here i am bind combo with encoded html and tried with item template as well with Server.HtmlDecode , initially it works fine but on item selected it's again encode the item. still have problem , i don't want to iterate my result set to decode and rows before bind combo. please suggest any solution.
0
Nencho
Telerik team
answered on 02 Jan 2015, 01:34 PM
Hello Sandeep,

Could you please demonstrate us the implementation that you use at your end, so we could inspect your proper scenario and pinpoint the problem locally?

Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ComboBox
Asked by
Trevor
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sandeep
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or