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

Problem with ComboBox with Image and Ajax

1 Answer 52 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
lupotana asked on 08 Jun 2010, 01:46 PM

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 ?


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 14 Jun 2010, 01:13 PM
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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question