add items to dropdownlist from database

2 posts, 0 answers
  1. ahmed
    ahmed avatar
    11 posts
    Member since:
    Feb 2018

    Posted 14 Mar 2018 Link to this post

    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);

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3991 posts

    Posted 15 Mar 2018 Link to this post

    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.
Back to Top