In Editor Template, Kendo Combobox DataSource does not hit the Controller method to populate the combobox

380 Views Asked by At

Editor Template has a Kendo.ComboBox() with the DataSource reading from a Controller:

  .DataSource(source =>
  {
    source.Read(read =>
    {
      read.Action("TheController", "TheMethod").Data("getReportId()");

    });
 })

The Editor Template is defined for the Grid's column in a Partial View page:

co.Bound(c => c.Name).Title("Name").EditorTemplateName("_TheEditor");

The Controller's method GetData, I think, should be called when Grid is populated:

public JsonResult GetData(int itemID)
{
    MyModel model = new MyModel();
    var dataList = model.GetData(itemID);
    ViewData["DataList"] = dataList;

    return Json(dataList.ToList() , JsonRequestBehavior.AllowGet);
}

What's wrong with my logic?

1

There are 1 best solutions below

0
Marissa Fernandes On

Refer to this editor template demo, also refer to the demo for cascading combo boxes to see how data is passed to combo box datasource read. I feel the error in your code is in the editor template .Data("getReportId()") remove the brackets.

.DataSource(source =>
  {
    source.Read(read =>
    {
      read.Action("TheController", "TheMethod").Data("getReportId");

    });
 })