MVC datasource and schema

2 posts, 0 answers
  1. Felipe Casanova
    Felipe Casanova avatar
    56 posts
    Member since:
    Feb 2010

    Posted 23 Jul 2012 Link to this post

    How do you specify where the data is in the response? In js I would specify that the total property is the "count" property and the data is in "data". I don't see how to do this in the MVC extensions.

    schema: {
                        total: "count",
                        data: "data",
                        model: {
                            id: "Id",
                            fields: {
                                Id: { editable: false, type: "number" },
                                StartDate: { type: "date" },
                                EndDate: { type: "date" }
  2. Vesselin Obreshkov
    Vesselin Obreshkov avatar
    81 posts
    Member since:
    Jan 2010

    Posted 23 Jul 2012 Link to this post

    When using the MVC extensions, you need to either return a DataSourceResult (yourIQueryable.ToDataSourceResult())  object or store your total in a ViewBag.Count variable in your controller and when defining your dataSource => dataSource.Total(ViewBag.Count) will tell the grid your total number of records.
  3. UI for ASP.NET AJAX banner
Back to Top