title: how to set total page count in webGrid helper
body: <p>I use WebGrid helper mvc for show data . I want get data by skip and count for do this I use this Action :</p>
  
  <pre><code>public static IList&lt;Employee&gt; CreateEmployees(int page,int count)
      {
          var skipe = page * count;
          var list = new List&lt;Employee&gt;();
          var rnd = new Random();
          for (int i = 1; i &lt;= 1000; i++)
          {
              list.Add(new Employee
              {
                  Id = i + 1000,
                  FirstName = "fName " + i,
                  LastName = "lName " + i,
                  AddDate = DateTime.Now.AddYears(-rnd.Next(1, 10)),
                  Salary = rnd.Next(400, 3000),
                  Projects = CreateRandomProjects()
              });
          }
  
          return list.Skip(skipe).Take(count).ToList();
      }
  </code></pre>
  
  <p>but when I show data in grid view It just has one page because I read 10 records each time , I want get Total page and set it to ViewBag and in View Set to total count in WebGrid . My code to show Grid is :</p>
  
  <pre><code>    @helper WebGridPageFirstItem(WebGrid grid)
  {
      @(((grid.PageIndex + 1) * grid.RowsPerPage) - (grid.RowsPerPage - 1));
  }
  
  @helper WebGridPageLastItem(WebGrid grid)
  {
      if (grid.TotalRowCount &lt; (grid.PageIndex + 1 * grid.RowsPerPage))
      {
          @grid.TotalRowCount;
  
      }
      else
      {
          @((grid.PageIndex + 1) * grid.RowsPerPage);
      }
  }
  
  &lt;h2&gt;Employees List&lt;/h2&gt;
  
  @{
      var grid = new WebGrid(
          source: Model,
          canPage: true,
          rowsPerPage: 10,
          canSort: true,
          defaultSort: "FirstName"
      );
      var salaryPageSum = 0;
      var taxPageSum = 0;
      var rowIndex = ((grid.PageIndex + 1) * grid.RowsPerPage) - (grid.RowsPerPage - 1);
  }
  
  &lt;div id="container"&gt;
      @grid.GetHtml(
              tableStyle: "webgrid",
              headerStyle: "webgrid-header",
              footerStyle: "webgrid-footer",
              alternatingRowStyle: "webgrid-alternating-row",
              selectedRowStyle: "webgrid-selected-row",
              rowStyle: "webgrid-row-style",
              htmlAttributes: new { id = "MyGrid" },
              mode: WebGridPagerModes.All,
              columns: grid.Columns(
                   grid.Column(header: "#",
                               style: "text-align-center-col",
                               format: @&lt;text&gt;@(rowIndex++)&lt;/text&gt;),
                   grid.Column(columnName: "FirstName", header: "First Name",
                               format: @&lt;span style='font-weight: bold'&gt;@item.FirstName&lt;/span&gt;,
                               style: "text-align-center-col"),
                   grid.Column(columnName: "LastName", header: "Last Name"),
                   grid.Column(header: "Image",
                               style: "text-align-center-col",
                               format: @&lt;text&gt;&lt;img alt="@item.Id" src="@Url.Content("~/images/" + @item.Id + ".jpg")" /&gt;&lt;/text&gt;),
  
                   grid.Column(header: "",
                               style: "text-align-center-col",
                               format: item =&gt; @Html.ActionLink(linkText: "Edit", actionName: "Edit",
                                                                controllerName: "Home", routeValues: new { id = item.Id },
                                                                htmlAttributes: null)),
                   grid.Column(header: "",
                               format: @&lt;form action="/Home/Delete/@item.Id" method="post"&gt;
                      &lt;input type="submit"
                             onclick="return confirm('Do you want to delete this record?');"
                             value="Delete" /&gt;
                  &lt;/form&gt;),
                       grid.Column(header: "", format: item =&gt; item.GetSelectLink("Select"))
                            )
                        )
  
      &lt;strong&gt;Page:&lt;/strong&gt; @(grid.PageIndex + 1) / @grid.PageCount,
      &lt;strong&gt;Records:&lt;/strong&gt; @WebGridPageFirstItem(@grid) - @WebGridPageLastItem(@grid) of @grid.TotalRowCount
  
  &lt;/div&gt;
  </code></pre>