Question about Kendo UI ASP.NET MVC

2 posts, 0 answers
  1. Paolo
    Paolo avatar
    426 posts
    Member since:
    Jun 2009

    Posted 07 Aug 2013 Link to this post

    after some initial test with Kendo UI and the reading  a book of Freeman about MVC I've decided to put struff toghether... but I've still some hiden point I've to finish analyzing...

    First : Does Kendo UI supports Entity Framework (in the specific case IdeaBlade's Devforce implementation)? I've tried with a single Entity and it was ok, added a relational one and the view doesn't load data anymore...

    Second: I've read I can use the Async ActionResult for MVC ...beign a fan of It I was wondering how should I load the data with KendoUI , consider for example this ActionResult

        public async Task<ActionResult>  GetClientiAsync([DataSourceRequest]DataSourceRequest request)
                IQueryable<I_CLIENTI> dataResult = await  clientiRepository.GetAllClientiAsync();
                DataSourceResult res = dataResult.ToDataSourceResult(request);

                return Json(res, JsonRequestBehavior.AllowGet);
    Third : On the book I've seen it uses the View(<model>)  returned... in some of your example you use Json to return data passing [DataSourceRequest] and as far I've understood it's in order to bind the kendo object on the View... What have I to use so?

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 09 Aug 2013 Link to this post

    Hello Paolo,

    To the questions:
    1. Using EntityFramework should not be a problem, many of our users use it and there are examples out there which use the same. I assume that in your case the problem is the serialization of such navigation properties that are created when there is one to many relation. Check this part of the troubleshooting guide to see if this is the case.

    2. I see no problem to use the async/await keywords inside the action method that returns the DataSourceResult. Check the following topic. If there is specific problem that you encounter please send us small demo project which replicates the case so we can advice you further.
    3. Basically some of the demos return collection as a View(<Model>) which is used by the Grid to initially populate the Grid - in this cases there is no additional Ajax request performed to get the data (because it is there on the server when the Grid is created). You can use the same approach and populate the Grid with some variable through the ViewData / ViewBag dictionary - there is not difference at all. Basically it is up to you if you want to populate the Grid initially (it is done via the BindTo method or passing that collection directly to the Grid(Model) constructor ) or use separate request. Complete info how to implement Ajax binding is explained here.

    Kind Regards,
    Petur Subev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top