Having a simple issue with binding data to a dropdown. Trying to follow from the demo code. The code for RemoteDataSource_GetFirms never gets called. Missing some basic concept I think.
Here is the controller:
public class ImpersonationController : Controller { public ActionResult Impersonation() { return View(); } // GET: Impersonation public ActionResult RemoteDataSource() //RemoteDataSource() { return View(); } public JsonResult RemoteDataSource_GetFirms(string text) { var fo = new FirmObject(); var firms = fo.GetFirms(); if (!string.IsNullOrEmpty(text)) { firms = firms.Where(p => p.SourceDataset.Contains(text)); } return Json(firms, JsonRequestBehavior.AllowGet); } }
View:
@{ Layout = null;}<!DOCTYPE html><html><head> <meta name="viewport" content="width=device-width" /> <title>Impersonate</title></head><body> <div class="demo-section k-content"> <h4>Select a Firm</h4> @(Html.Kendo().DropDownList() .Name("ddFirms") .DataTextField("SourceDataset") .DataValueField("FirmID") .DataSource(source => { source.Read(read => { read.Action("RemoteDataSource_GetFirms", "Impersonation"); }); }) .HtmlAttributes(new { style = "width: 100%" }) ) </div></body></html>