Kendo UI MVC Grid Not Filtering

2 posts, 0 answers
  1. Jennifer
    Jennifer avatar
    4 posts
    Member since:
    Oct 2015

    Posted 27 Oct 2017 Link to this post

    Hello,

    I'm currently using ASP.NET MVC Kendo UI to generate a Grid. I am able to filter one column, but upon filtering a second or more columns, I receive a '500 Internal Server Error' (see the attached screenshot). The code files are as follows:

    View.cshtml

    01.<head>
    02.    <link href="@Url.Content("~/Content/kendo/2017.3.1018/kendo.common.min.css")" rel="stylesheet" type="text/css" />
    03.    <link href="@Url.Content("~/Content/kendo/2017.3.1018/kendo.mobile.all.min.css")" rel="stylesheet" type="text/css" />
    04.    <link href="@Url.Content("~/Content/kendo/2017.3.1018/kendo.default.min.css")" rel="stylesheet" type="text/css" />
    05.    <link href="@Url.Content("~/Content/kendo/2017.3.1018/kendo.rtl.min.css")" rel="stylesheet" type="text/css" />
    06. 
    07.    <script src="~/Scripts/jquery-1.10.2.js" type="text/javascript"></script>
    08.    <script src="@Url.Content("~/Scripts/kendo/2017.3.1018/kendo.web.min.js")"></script>
    09.    <script src="@Url.Content("~/Scripts/kendo/2017.3.1018/kendo.aspnetmvc.min.js")"></script>
    10.</head>
    11.<body>
    12.<div class="row">
    13.    @Html.AntiForgeryToken()
    14.    @(Html.Kendo().Grid<JccsRecordsRequest.ViewModels.SubmittedList>()
    15.        .Name("SubmittedRequests")
    16.        .Columns(columns =>
    17.        {
    18.            columns.Bound(p => p.LastName).Title("Last Name")
    19.            columns.Bound(p => p.FirstName).Title("First Name")
    20.            columns.Bound(p => p.BirthDate).Title("Date of Birth").Format("{0:MM/dd/yyyy}");
    21.            columns.Bound(p => p.CreateDate).Title("Date & Time Submitted").Format("{0:MM/dd/yyyy hh:mm:ss tt}");
    22.            columns.Bound(p => p.RequestorType).Title("Request Type");
    23.            columns.Bound(p => p.RequestorID).Title("").Filterable(false)
    24.            .ClientTemplate(Html.ActionLink("View", "RequestDetail", new { id = "#= RequestorID #", RequestStatus = "#= RequestStatus #", ButtonID = "Start" }, new { @class = "btn btn-success" }).ToHtmlString());
    25.        })
    26. 
    27.        .Pageable()
    28.        .Sortable()
    29.        .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
    30.        .DataSource(source => source
    31.            .Ajax()
    32.            .PageSize(20)
    33.            .Read(read => read.Action("GetSubmittedRequests", "Admins").Data("sendAntiForgery"))
    34.        )
    35.    )
    36.</div>
    37. 
    38. 
    39.<script type="text/javascript">
    40.    function sendAntiForgery() {
    41.        return { "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val() }
    42.    }
    43.</script>
    44.</body>

     

    Controller.cs

    01.[HttpPost]
    02.[ValidateAntiForgeryToken]
    03.public ActionResult GetSubmittedRequests([DataSourceRequest] DataSourceRequest request)
    04.{
    05.    return Json(SubmittedRequestsList().ToDataSourceResult(request));
    06.}
    07. 
    08.public IEnumerable<SubmittedList> SubmittedRequestsList()
    09.{
    10. 
    11.    var db = new RecordRequestContext();
    12. 
    13.    var SubmitedRequestsEnum = db.Requestor
    14.        .Where(w => w.RequestStatus == RequestStatus)
    15.        .OrderByDescending(o => o.CreateDate)
    16.        .Select(sl => new SubmittedList
    17.        {
    18.            RequestorID = sl.RequestorID,
    19.            StudentLastName = sl.LastName,
    20.            StudentFirstName = sl.FirstName,
    21.            StudentBirthDate = sl.BirthDate,
    22.            CreateDate = sl.CreateDate,
    23.            RequestorType = sl.RequestorType,
    24.            RequestStatus = sl.RequestStatus,
    25.            RequestCount = (from a in db.Requestor where a.RequestStatus == RequestStatus select a).Count()
    26.        }
    27.        ).ToList();
    28.    return SubmitedRequestsEnum;
    29.}

    Upon inspection in Google Developer Tools, it just occurs when we filter on more than one column. We are using the latest Kendo UI javascript files (2017.2.1018), so I'm unsure what is going on.

    Please advise. Thanks.

  2. Stefan
    Admin
    Stefan avatar
    2835 posts

    Posted 30 Oct 2017 Link to this post

    Hello, Jennifer,

    This is a known issue which is already fixed.

    The fix is available in our latest Service Pack v2017.3.026 and can be downloaded now.

    Apologies for the inconvenience this may have caused you.

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top