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

MVC 6 - Nested Grids

1 Answer 181 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jako
Top achievements
Rank 1
Jako asked on 22 Apr 2016, 10:39 AM

Hi everyone, I have a .Net Core/MVC6 application. I get all the Kendo controls to render using the .Deferred() option, but I can't get the ClientTemplate Grids to work? Here is the code

[code]

@(Html.Kendo().Grid<UserViewModel>()
.Name("UserGrid")
.Columns(columns =>
{
columns.Bound(u => u.FirstName);
columns.Bound(u => u.LastName);
columns.Bound(u => u.Email);
})
.ClientDetailTemplateId("userOrders")
.Sortable()
.Pageable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(30)
.Read(read => read.Action("UserGrid_Read", "Admin"))
)
.Events(events => events.DataBound("userGridBind"))
.Deferred()
)

<script id="userOrders" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<UserOrderViewModel>()
            .Name("UserOrders_#=UserId#")
            .Columns(columns =>
            {
                columns.Bound(o => o.OrderVat);
                columns.Bound(o => o.OrderTotal);
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .Read(read => read.Action("UserGrid_Orders", "Admin", new { userId = "#=UserId#" }))
            )
            .Pageable()
            .Deferred()
            .ToClientTemplate()
    )
</script>

[/code]

I receive a Syntax error, unrecognized expression: #UserOrders_#=UserId#

I have tried remove the deferred, then it doesn't render at all. I have also tried using \\#=UserId\\# but no change.

How do we get it to work using .Net Core/MVC6 and the deferred options?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Jako
Top achievements
Rank 1
answered on 22 Apr 2016, 11:34 AM

Found the problem.

 

I had a [Display(Name = "Order #")] attribute in my view model that was causing the problems...

Tags
Grid
Asked by
Jako
Top achievements
Rank 1
Answers by
Jako
Top achievements
Rank 1
Share this question
or