.Events(e => e.Change("OnCurResellerChanged"))
In that event simply make the form submit like shown below -
Say I have a model fro dropdownlist -
public class DDLModel
{
public List<SelectListItem> Items { get; set; }
public string SelectedValue { get; set; }
}
Then I populate the model and send it to View in the following action -
public ActionResult Index()
{
DDLModel model = new DDLModel();
model.Items = new List<SelectListItem>();
model.Items.Add(new SelectListItem() { Text = "1", Value = "1" });
model.Items.Add(new SelectListItem() { Text = "2", Value = "2" });
model.Items.Add(new SelectListItem() { Text = "3", Value = "3" });
return View(model);
}
And my View comprises of a AJAX form. We need to give an id
to the form as shown below.
@model MVC.Controllers.DDLModel
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
<script>
function Call() {
$("#form1").submit();
}
</script>
@using (Ajax.BeginForm("Submit", "Ajax", new AjaxOptions { UpdateTargetId = "SellerWebSettings" }, new { id = "form1" }))
{
@Html.DropDownListFor(m => m.SelectedValue, Model.Items, "DDL", new { @onchange = "Call()" })
}
So when you change the Dropdownlist value, form will be submitted using jquery and corresponding controller action will be hit with the selected value. You can do the following in the change function of kendo dropdownlist.
Output -