I got this error (see attachement).
The view :
The controller :
And I don't have those line web.config
The view :
@(Html.Kendo().Grid<
MesFormations.Models.EmployeGridView
>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(e => e.NomEmploye).Width(110);
columns.Bound(e => e.CourrielEmploye).Width(110);
columns.Bound(e => e.Telephone).Width(110);
columns.Bound(e => e.PosteTelephone);
})
.Sortable()
.Pageable()
.Scrollable()
.ClientDetailTemplateId("template")
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(6)
.Read(read => read.Action("HierarchyBinding_Employees", "Employe"))
)
.Events(events => events.DataBound("dataBound"))
)
<
script
id
=
"template"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
MesFormations.Models.FormationEmployeGridView
>()
.Name("grid_#=NoEmploye#")
.Columns(columns =>
{
columns.Bound(o => o.NoFormation).Width(70);
columns.Bound(o => o.DateFormation).Width(110);
columns.Bound(o => o.DateModification);
columns.Bound(o => o.Remarques).Width(200);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Read(read => read.Action("HierarchyBinding_Orders", "Employe", new { employeeID = "#=NoEmploye#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</
script
>
<
script
>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</
script
>
public ActionResult HierarchyBinding_Employees([DataSourceRequest] DataSourceRequest request)
{
return Json(GetEmployees().ToDataSourceResult(request));
}
public ActionResult HierarchyBinding_Orders(int employeeID, [DataSourceRequest] DataSourceRequest request)
{
return Json(GetOrders()
.Where(order => order.NoEmploye == employeeID)
.ToDataSourceResult(request));
}
private static IEnumerable<
FormationEmployeGridView
> GetOrders()
{
var northwind = new FormationContext();
//var loadOptions = new DataLoadOptions();
//loadOptions.LoadWith<
Order
>(o => o.Customer);
//northwind.LoadOptions = loadOptions;
return northwind.FormationEmploye.Select(order => new FormationEmployeGridView
{
NoFormationEmploye = order.NoFormationEmploye,
NoEmploye = order.NoEmploye,
NoFormation = order.NoFormation,
DateFormation = order.DateFormation,
Remarques = order.Remarques,
DateModification = order.DateModification
});
}
private static IEnumerable<
EmployeGridView
> GetEmployees()
{
var northwind = new FormationContext();
return northwind.Employes.Select(employee => new EmployeGridView
{
NoEmploye = employee.NoEmploye,
PrenomEmploye = employee.PrenomEmploye,
NomEmploye = employee.NomEmploye,
CourrielEmploye = employee.CourrielEmploye,
Telephone = employee.Telephone,
PosteTelephone = employee.PosteTelephone
});
}
And I don't have those line web.config
<
httpRuntime
targetFramework
=
"4.5"
encoderType
=
"System.Web.Security.AntiXss.AntiXssEncoder, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>