title: Custom Paging for ASP.Net MVC Kendo Grid
body: <p>I have a MVC Kendo Grid as follows.  It is working fine with default paging. </p>
  
  <p>Now, I want to do custom paging. In the controller action we need to know the current page index. Also it should set the “total” count for the grid. [The actual data source will have only 2 records at a time even if there are 100 records in the database. So the grid must know the total number of records in database using “total” attribute.]</p>
  
  <p>The query should return only 2 records from the database at a time.</p>
  
  <p>How can we do this custom server paging using the MVC wrapper for Kendo Grid?</p>
  
  <pre><code>@using (Html.BeginForm())
  { 
  
      @(Html.Kendo().Grid&lt;KendoUIMvcSample.Models.Sample&gt;()    
      .Name("ssgrid222")
      .Columns(columns =&gt; {
          columns.Bound(p =&gt; p.SampleDescription).Filterable(false).Width(100);
          columns.Bound(p =&gt; p.SampleCode).Filterable(false).Width(100);
          columns.Bound(p =&gt; p.SampleItems).Filterable(false).Width(100);
      })
      .AutoBind(false)
      .Pageable()
      .Sortable()
      .Scrollable()
      .Filterable()
      .HtmlAttributes(new { style = "height:430px;" })
      .DataSource(dataSource =&gt; dataSource
          .Ajax()
          .PageSize(2)
          .Read(read =&gt; read.Action("Orders_Read", "Sample")
  )
       )
    )
  }
  </code></pre>
  
  <p><strong>Controller</strong> </p>
  
  <pre><code>public ActionResult Orders_Read([DataSourceRequest]DataSourceRequest request)
          {
  
              int currentPageNumber = request.Page;
              return Json(GetOrders().ToDataSourceResult(request));
          }
  </code></pre>