Hi,
I have a DropDownList that is initially binded on the server side with BindTo method (I am using DropDownListFor).
On the client (JS code) I need to clear its items and then repoppulate the control with other items.
What is the best practice to accomplish this?
Thanks,
Lauri
1 Answer, 1 is accepted
0
Petur Subev
Telerik team
answered on 26 Jul 2013, 08:35 AM
Hello Shachar,
Basically to control what items are used by the DropDownList you need to use the dataSource objects and its methods.
In your case you will need to get reference to the client object and use the dataSource.data() method.
e.g.
var ds = $('#ddlName').data().kendoDropDownList.dataSource;
// make sure that the objects that you use to populate the dataSource have the same fields as the ones that you specified in the DataTextField and DataValueField of your DropDownList
I hope this helps.
Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!