RadComboBox is binding image as text

2 posts, 0 answers
  1. suhashini
    suhashini avatar
    11 posts
    Member since:
    May 2014

    Posted 01 Dec 2015 Link to this post

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

  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 03 Dec 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top