Using HTML entities in the text of a RadComboBoxItem control

4 posts, 0 answers
  1. Trevor
    Trevor avatar
    11 posts
    Member since:
    Oct 2010

    Posted 18 Mar 2011 Link to this post

    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:

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

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

    Any ideas about how to prevent the RadComboBox from escaping HTML entities?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Mar 2011 Link to this post

    Hello Tervor,

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

  3. Sandeep
    Sandeep avatar
    1 posts
    Member since:
    Dec 2014

    Posted 30 Dec 2014 in reply to Shinu Link to this post

    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.
  4. Nencho
    Nencho avatar
    1661 posts

    Posted 02 Jan 2015 Link to this post

    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?


    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.

Back to Top