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

Question about Kendo UI ASP.NET MVC

1 Answer 193 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 07 Aug 2013, 02:13 PM
Hello,
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?

Thanks

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 09 Aug 2013, 01:03 PM
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.
    http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq#how-do-i-avoid-circular-reference-exceptions?

  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
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Michele
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or