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

DropDownListItem with image and text

2 Answers 353 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Artem
Top achievements
Rank 1
Artem asked on 19 Feb 2012, 11:31 AM
Hello dear Telerik team.
I am using RadDropDownList to let the user choose from four options. Those options are absolutely static, so I create four dropDownItems hardcoded. Each option has its text and image. I can define each item by a lode like :

var radListDataItem1 = new RadListDataItem();
            radListDataItem1.Image = Properties.Resources.SomeImage;
            radListDataItem1.Text = "Sometext";           
            radListDataItem1.Value = someValue;

            var source = new BindingList<RadListDataItem>();

            source.Add(radListDataItem1);

            cmbTriggerType.DataSource = source; //cmbTriggerType is my RadDropDownList

//same for three more items

            cmbTriggerType.SelectedIndex = 0;

And now here comes the question! :)
What should I do to cause your control to render each DataItem  with both text and image visible?
Thanks in advance.
Artem

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 21 Feb 2012, 04:46 PM
Hi Artem,

Thank you for writing.

This is not the correct way to data-bind the RadDropDownList/RadListControl.
Please take a look at this documentation article about the data-binding.

I would like to suggest to reading this help article about item customizations (adding an image).

I hope this helps.

Greetings,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Artem
Top achievements
Rank 1
answered on 21 Feb 2012, 05:22 PM
Thanks, Peter!
This helped indeed.
Tags
DropDownList
Asked by
Artem
Top achievements
Rank 1
Answers by
Peter
Telerik team
Artem
Top achievements
Rank 1
Share this question
or