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

RadComboBox is binding image as text

1 Answer 149 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
suhashini
Top achievements
Rank 1
suhashini asked on 01 Dec 2015, 10:40 AM

Hi,

  I want to bind image to radcombobox and iits composite control and in attribute i am binding image but its no displaying image please help!!

 

  private static RadComboBoxItemData ConvertData(IAutoCompleteItem item)
        {
            var data = new RadComboBoxItemData();
             
            foreach (KeyValuePair<string, object> itm in item.Attributes)
            {
              //  data.Attributes[itm.Key] = itm.Value;
                //string imageURL = string.Format(null, "<div class=\"bed_priority_field\"><img src=\"../img/assignment_{0}.png\" /></div>", "priority");
                
                //    data.Attributes["style"] = "background: url(" + imageURL + ");background-repeat:no-repeat;";
              
                //  _radItem.Attributes["imgpath"] = "../img/assignment_priority.png";
                data.Attributes[itm.Key] = "<html>< head></head><body><img src=\"../img/assignment_priority.png\" /></body></html>";
                  
            }

            data.Text = item.Text;
            data.Enabled = item.Enabled;
            data.Value = item.Value;
            return data;
        }

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 03 Dec 2015, 08:57 AM
Hello Сuhashini,

The approach that we suggest for such scenarios is to use the ClientTemplate of the RadComboBox, where you can define the needed image and only provide the control with the data source. Pleas refer to the following online demo and documentation article, where this functionality is demonstrated and described:

Regards,
Nencho
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ComboBox
Asked by
suhashini
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or