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

viewmodel from post - unable to bind in kendo Grid

1 Answer 14 Views
Grid
This is a migrated thread and some comments may be shown as answers.
E
Top achievements
Rank 1
E asked on 06 Dec 2020, 11:36 AM

I am struggling for last 3 days. all nugets installed.. and contoller is doing all that needs to do and returning viewmodel back to index view. but kendo grid doesn't render any thing. code below. am i doing any thing wrong here?

**************************************************************************************

@model Icaew.StudentRegistration.Admin.WebApp.Models.UserSearchViewModel
@using Kendo.Mvc.UI
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.common.min.css" />
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.rtl.min.css" />
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.silver.min.css" />
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.mobile.all.min.css" />
<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="http://kendo.cdn.telerik.com/2017.1.118/js/kendo.all.min.js">
</script>
<main class="primary content">    
    <div class="row">
        <div class="columns">     
            @if (Model != null && ViewBag.UsersCount >= 1 && !Model.HasError)
            {
                @(Html.Kendo().Grid(Model.SearchResult)
                        .Name("grid")
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(2)
                            .ServerOperation(false)
                         )
                        .ToolBar(tools =>
                        {
                            tools.Pdf().Text("Custom PDF button text");
                            tools.Excel().Text("Custom Excel button text");
                        })
                        .Pageable()
                        .Sortable()
                        .Groupable()
                        .Columns(columns =>
                        {
                            columns.Bound(f => f.RecordCode);
                            columns.Bound(f => f.Firstname);
                        })
               )
            }
            <a asp-area="" class="cta-link" asp-controller="Home" asp-action="Index">Back</a>
        </div>
    </div>
</main>
************************************************************************************************************************************

please can anyone help me? am i not including any css or js?

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 09 Dec 2020, 12:37 PM

Hello,

Thank you for the provided snippets.

The grid definition appears to be as expected but the scripts and styles are outdated and also the kendo.aspnetmvc.min.js is missing which is likely causing a kendo.syncReady is not a function error in the console. You can verify this by opening the Developer Tools with F12 and checking the console tab.

I am attaching here an ASP.NET Core sample project using the same configuration as you have shared for your reference.

Let us know in case you need further assistance.

Regards,
Alex Hajigeorgieva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
E
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or