performance issue when loading images in to the combo box.

Thread is closed for posting
2 posts, 0 answers
  1. Ragupathi
    Ragupathi avatar
    41 posts
    Member since:
    Jul 2008

    Posted 18 Dec 2008 Link to this post

    I am adding gif files in to my Radcombobox items. But while adding the images, combobox is taking time to load those images.

    Please find the following code which I used to populate the images.

    RadComboBoxItem item;                   
                             for (int i = 0; i < dtTables.Rows.Count; i++)
                                item = new RadComboBoxItem();
                                if (dtTables.Rows[i][1].ToString() == "Table")
                                    item.Image = Image.FromFile(imagepath1);
                                    item.TextImageRelation = TextImageRelation.ImageBeforeText;
                                    item.Image = Image.FromFileimagepath2);
                                    item.TextImageRelation = TextImageRelation.ImageBeforeText;
                                item.Text = dtTables.Rows[i][0].ToString();

    RowCount  will be around 450. If I remove the images then loading data in to the combo box is fast.

    Can you please let me know any thing I can do for improving the performance. ?

    Thanks in Advance.
  2. Nikolay
    Nikolay avatar
    1805 posts

    Posted 20 Dec 2008 Link to this post

    Hello Ragupathi,

    Thank you for the question.

    In order to optimize the performance, you should read the images from the files in advance and put them into an ImageList. Then, when you start creating and adding RadComboBoxItems, use this ImageList to get the necessary images. I am attaching a sample project that demonstrates this approach.

    You can get another performance optimization by using BeginUpdate/EndUpdate. You can find an example of calling these methods in our Quick State Framework examples, section Editors >> RadComboBox >> Loading items.

    I hope this helps. If you have additional questions, feel free to contact me.

    All the best,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top