I am facing a challenge with my Kendo UI dropdownlist which has a select
event managed by a JavaScript function.
The issue I'm encountering is how to trigger an action result from a controller that executes a LINQ query to populate a Kendo UI grid on the webpage. The only way I currently see to handle this event is through JavaScript, but I haven't been successful in figuring out how to call my controller's action result from the JavaScript function.
This is the code for the DropDownList
:
@(Html.Kendo().DropDownList()
.Name("Options")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>() {
new SelectListItem() {
Text = "Policies Not Archived",
Value = "1"
},
new SelectListItem() {
Text = "View All Policies",
Value = "2"
},
new SelectListItem() {
Text = "Filter Policies",
Value = "3"
}
})
.Events(e =>
{
e.Select("select");
})
)
Below is my JavaScript event handler which needs to invoke the action result:
function select(e) {
}
Depending on the selection, the ActionResult
will look like this:
public ActionResult ViewAllPolicies()
{
//mycode
}