0

I have been assigned with populating a grid on page load with data through a LLBL adapter model. I am able to retrieve the results as I can see them when i set a break point. The end result of my assignment is to load all bundles from yesterday and before and if there "IsSent" property is False then I need to switch it to True. My question is how do i get past the initial loading of the Grid? I have followed the Demos as much as I can but I cant get it to work.

Controller

public ActionResult BundleStatusRead([DataSourceRequest] DataSourceRequest request)
    {
        DataAccessAdapter adapter = new DataAccessAdapter();
        EntityCollection allBundles = new EntityCollection(new CarrierBundleEntityFactory());
        adapter.FetchEntityCollection(allBundles, null);
        var results = allBundles;

        return Json(results.ToDataSourceResult(request));
    }

View

@{
ViewBag.Title = "BundleStatusGet";
 }

  <div id="clientsDb">
@(Html.Kendo().Grid<ZoomAudits.DAL.EntityClasses.CarrierBundleEntity>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(c => c.BundleId).Width(140);
        columns.Bound(c => c.CarrierId).Width(190);
        columns.Bound(c => c.Date);
        columns.Bound(c => c.IsSent).Width(110);
    })
    .HtmlAttributes(new { style = "height: 380px;" })
    .Scrollable()
    .Groupable()
    .Sortable()
    .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(true)
        .ButtonCount(5))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("BundleStatusRead", "BundleStatus"))
    )
)

Error Message Error 1 'ZoomAudits.DAL.HelperClasses.EntityCollection' does not contain a definition for 'ToDataSourceResult' and no extension method 'ToDataSourceResult' accepting a first argument of type 'ZoomAudits.DAL.HelperClasses.EntityCollection' could be found (are you missing a using directive or an assembly reference?)

1 Answers1

2

I was missing the Kendo.Mvc.Extensions reference

using Kendo.Mvc.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZoomAudits.DAL.DatabaseSpecific;
using ZoomAudits.DAL.EntityClasses;
using ZoomAudits.DAL.FactoryClasses;
using ZoomAudits.DAL.HelperClasses;
using Kendo.Mvc.Extensions;
using SD.LLBLGen.Pro.ORMSupportClasses;
using System.Web.Script.Serialization;