Problem with ComboBox with Image and Ajax

2 posts, 0 answers
  1. lupotana
    lupotana avatar
    73 posts
    Member since:
    Nov 2006

    Posted 08 Jun 2010 Link to this post

    I'm a RadComboBox with Image and Text.

    For popolate the combo I use this method.

    foreach (DataRow dr in dt.Rows)  
        RadComboBoxItem item = new RadComboBoxItem(dr[descriptionColumn].ToString(), dr[codeColumn].ToString());  
            item.ImageUrl = string.Format("{0}/{1}.png", pathFolder, dr[imageColumn].ToString());  

    It's all right, I see the image.

    When I insert my combo in an UpdatePanel or RadAjaxPanel I don't view the image but an only red cross.

    I suppose that Ajax doesn't succeed to open a phisical file.

    Is it right? Is not possibile use ComboBox with image in an Ajax scenario ?


  2. Veronica
    Veronica avatar
    1213 posts

    Posted 14 Jun 2010 Link to this post

    Hello lupotana,

    I've tested your case with an RadAjaxPanel. Here's the code:

    protected void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
            RadComboBox combo = (RadComboBox)o;
            string pathFolder = "~/Images";
            SqlConnection connection =
                   new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
            SqlCommand selectCommand =
                new SqlCommand(@" SELECT * FROM Employees", connection);
            SqlDataAdapter adapter = new SqlDataAdapter(selectCommand);
            DataTable dt = new DataTable();
            foreach (DataRow row in dt.Rows)
                RadComboBoxItem item = new RadComboBoxItem();
                item.Text = row["FirstName"].ToString() + " " + row["LastName"].ToString();
                item.Value = row["EmployeeID"].ToString();
                item.ImageUrl = string.Format("{0}/{1}.png", pathFolder, row["LastName"].ToString());

    Find the full code in the attached .zip file.

    Hope this helps.

    Kind regards,
    Veronica Milcheva
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top