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


1 Answer 816 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
LMG asked on 02 Apr 2014, 09:39 PM
Hi I am very new to this and need help in kendoDropDownList
I am using kendoDropDownList and as soon as user selects the dropdown item - i need to postback to Controller action method with the appropriate value
ex: if user selects "Test 1", i need to send to controller "4" - how do i do it?
here is my code

        $(document).ready(function () {
            var data = [
                { text: "ALL", value: "-1" },
                { text: "Test 1", value: "4" },
                { text: "Test 2", value: "32" }

            //var selectedValue = $("#assayTypeIDIndex").val();
                dataTextField: "text",
                dataValueField: "value",
                dataSource: data,                                
                ignoreCase: false,            
                select: onSelect,
                index: 0 // another issue is I cannot set the selectedValue (defined above) here????? if i do it this wouldn't work - only numeric hardcoded value (0 or 1 or 2) will work

            function onSelect(e) {
                var atIdx = e.item.index();
                var atValue = this.dataItem(e.item.index()).value;                   
thanks in adv...

1 Answer, 1 is accepted

Sort by
Alexander Popov
Telerik team
answered on 04 Apr 2014, 10:42 AM
Hi Vikas,

The this keyword refers to the DropDownList's instance, so in case you want to find the closest form I would suggest using the following approach: 
Changing the selected items through the API is done by setting the DropDownList's value. Here is a small example that illustrates the above.

Alexander Popov
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question