1. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 01 Feb 2013 Link to this post

    if i have this code
    @(Html.Kendo().Grid(Model)    
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.emplmark).Groupable(false);
            columns.Bound(p => p.firstname);
            columns.Bound(p => p.lastname);
            columns.Bound(p => p.location);
            columns.Bound(p => p.county);
        })
        .Groupable()
        .Pageable()
        .Sortable()
        .Scrollable()
        .Filterable()
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("GetWork", "Company"))
        )
    )

    The source return around 2000 records,but after i press next page(page 2),the data disapear.why?it isn't enough to put Pageable,to work the paging?
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 01 Feb 2013 Link to this post

    Hello Daniel,

    I guess you haven't setup your controller currently. See the step-by-step article on how to implement ajax binding:
    http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/ajax-binding

    Regards,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 04 Feb 2013 Link to this post

    i supose you are refering to the using of ToDataSourceResult() in controller,which i haven't did,just return a source of data in json.Now i change the code with that.
    But the problem is that in this example i use classic Entity framework ORM,i want it to map quickly to a real database with a lot of data
    so temployees,is a generated class  of type ObjectSet ,and i put this code,
    public ActionResult GetEmployees([DataSourceRequest]DataSourceRequest request)
            {
           var list=new AWModel.AWEntities().temployees;
              
                
                DataSourceResult result = list.ToDataSourceResult(request);

              
                return Json(result,JsonRequestBehavior.AllowGet);   
    }

    and the error is:
    Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property
    the ToDataSourceResult doesn't do the paging of datasource?what can i do in this case?

    Regards,
    Daniel
  4. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 05 Feb 2013 Link to this post

    Hello Daniel,

    What ToDataSourceResult extension method does is to apply all server operations(sorting/filtering/paging/grouping..etc.) over the data source and format the response returned to client grid object.

    In order to implement server paging the response on read request should return paged data collection in Data field and Total field for the total count of items(so the pager can be properly build). ToDataSourceResult does that for you.

    Regarding the error you receive here are few possible solutions:
    http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/troubleshooting#error-during-serialization-or-deserialization-using-the-json-javascriptserializer

    Regards,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 06 Feb 2013 Link to this post

    thank you for this link,very helpful.

    Best Regards,
    Daniel
Back to Top