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

performance issue when loading images in to the combo box.

1 Answer 47 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ragupathi
Top achievements
Rank 1
Ragupathi asked on 19 Dec 2008, 05:08 AM
Hi
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;
                            }
                            else
                            {
                                item.Image = Image.FromFileimagepath2);
                                item.TextImageRelation = TextImageRelation.ImageBeforeText;
                            }
                            item.Text = dtTables.Rows[i][0].ToString();
                            cbx.Items.Add(item);
                        }

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.
Raghu

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 20 Dec 2008, 02:55 PM
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,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Ragupathi
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or