In one of my pages I am trying to load data when DropDown
Value is changed. However I have hard time in call contoller’s action method on
dropdown’s onchange event. If you have any sample available please share with
me.
1 Answer, 1 is accepted
0
Georgi Krustev
Telerik team
answered on 09 Oct 2014, 06:52 AM
Hello Ajay,
I suppose that you've wired the widget change event (via the Change method) to detect whether the value has been changed. In this event handler you can use $.ajax to call the Action method in question:
[cshtml]:
@(Html.Kendo().DropDownList()
.Name("name")
...
.Events(e => e.Change("ddl_change"))
...
)
[JavaScript]:
function ddl_change(e) {
var widget = e.sender;
var value = widget.value();
$.ajax({
url: "Action url",
data: { ddlValue: value },
success: function(data) {
//do what you need here
}
})
}
Here is a tutorial, which popped out after a quick Google search, that explains different ways to call Controller Action method.
Regards,
Georgi Krustev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.