I need to initialize Kendo.ComboBox inside of the Editor Template.
I have defined the template as follows:
<script>
function GetReportID() {
return {
reportID: 8
}
}
</script>
@(Html.Kendo().ComboBox()
.DataValueField("ReportPropertyID")
.DataTextField("PropertyName")
.DataSource(d => d.Read(r => r.Action("PopulateReportProperty", "TestTicketReportProperty").Data("GetReportID()"))))
This template is rendered inside of the Kendo.Grid:
columns.Bound(p => p.ReportPropertyData).ClientTemplate("#=ReportProperty.PropertyName#").EditorTemplateName("_PropertyNameEditor").Sortable(false).Width(180);
The method inside of the controller that needs to be called:
[HttpPost]
public ActionResult PopulateReportProperty([DataSourceRequest] DataSourceRequest request, int reportID)
{
var reportProperty = TicketReportPropertyRepository.GetReportPropertyEntityRepository(reportID);
ViewData["defaultPropertyEntity"] = reportProperty.First();
return Json(reportProperty.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
This method is not called.
What am I doing wrong?
Is your _PropertyNameEditor file located inside your Views>Shared>EditorTemplates folder?
Also you may need to do [UIHint("_PropertyNameEditor")] on the attribute in your ViewModel.