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

Adding Items on Client Side

3 Answers 237 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 15 Jul 2013, 08:05 PM
Is there an example anywhere that shows how to add new items on the client side to the dropdown list?

The documentation seems to be lacking any examples really for the dropdowns client side.

3 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 15 Jul 2013, 08:29 PM
I found the code in the template section for adding a item on the client side.  The code however seems to be incorrect because there is no Telerik.Web.UI.RadDropDownListItem()  but rather Telerik.Web.UI.DropDownListItem().

Also the RadDropDownListItemCollection does not even state that the Add method exists?

0
Shinu
Top achievements
Rank 2
answered on 16 Jul 2013, 06:33 AM
Hi Mark,

Please have a look at the following code I tried to add a RadDropDownList item from client side.

JavaScript:
<script type="text/javascript">
    function addItem() {
        var raddropdownlist = $find('<%=RadDropDownList1.ClientID %>');
        var dropdownItem = new Telerik.Web.UI.DropDownListItem();
        dropdownItem.set_text("ItemText");
        raddropdownlist.get_items().add(dropdownItem);
    }
</script>

Thanks,
Shinu.
0
Nencho
Telerik team
answered on 18 Jul 2013, 12:09 PM
Hello Mark,

Your observations are absolutely correct. Thank you for your pointing that out. I have already fixed the mentioned inaccuracy in our documentation articles and they will be updated soon. As a token of gratitude, I have updated your Telerik Points.

Regards,
Nencho
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
DropDownList
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Nencho
Telerik team
Share this question
or