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

add items to dropdownlist from database

1 Answer 600 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
ahmed
Top achievements
Rank 1
ahmed asked on 14 Mar 2018, 11:20 AM

I want to add result of sql query to dropdownlist items

 

 have tried this :

 

RadListDataItem dataItem = new RadListDataItem();
                            dataItem.Text = (read1["size"].ToString());
                            this.radDropDownList2.Items.Add(dataItem);

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Mar 2018, 12:23 PM
Hello, Ahmed, 

Thank you for writing.  

In order to populate RadDropDownList with data you have two approaches:

1. Add the items programmatically to the Items collection: https://docs.telerik.com/devtools/winforms/dropdown-listcontrol-and-checkeddropdownlist/dropdownlist/populating-with-data/adding-items-programmatically

2. Bind RadDropDownList: https://docs.telerik.com/devtools/winforms/dropdown-listcontrol-and-checkeddropdownlist/dropdownlist/populating-with-data/data-binding

You can also refer to our Demo application >> DropDown & List >> DropDownList >> DataBinding example. The Demo application can be found in the installation folder of the suite. 
  
I hope this information helps. Should you have further questions I would be glad to help. 
 
 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownList
Asked by
ahmed
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or