This is a migrated thread and some comments may be shown as answers.

kando.all.min.js invalide template

5 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Louis asked on 20 May 2013, 02:28 AM
I got this error (see attachement).

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>
The controller :

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" />

5 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 20 May 2013, 02:53 PM
Hi Louis,


The implementation of the hierarchy grids seems correct. The only issue, that I found is a difference in the name of the property NomEmploye. In the EmployeGridView model of the master grid it is called NomEmploye, but in the Name() and the read.Action() of the child grid it is NoEmploye.

Please let me know if this was the reason for the error in the current scenario or I could assist you further?

 

All the best,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Louis
Top achievements
Rank 1
Iron
Iron
Iron
answered on 20 May 2013, 02:57 PM
Hello Dimiter,

Thank you for the fast answer.

Curiously, when I put in comment .Pageable()  it's working...

Any Idea?

<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#" }))
            )
            .Sortable()
            //.Pageable()           
            .ToClientTemplate()
    )
</script>
0
Dimiter Madjarov
Telerik team
answered on 21 May 2013, 01:46 PM
Hello Louis,


I tried to reproduce this strange behavior on my side, but to no avail. If it is convenient, could you send me a sample project, where the issue is reproducing, so I could test it locally and pinpoint the reason for the problem?

I am looking forward to hearing from you.

 

All the best,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Louis
Top achievements
Rank 1
Iron
Iron
Iron
answered on 21 May 2013, 04:21 PM
Hi  Dimiter,

Yes what's your email adress so I can send you the project?
0
Dimiter Madjarov
Telerik team
answered on 22 May 2013, 10:47 AM
Hi Louis,

The easiest way to send me the project would be to attach it as a zip archive to your post. 

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dimiter Madjarov
Telerik team
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or