title: Pagination-asp.net mvc 4
body: <p>I have problems in displaying page on how to include the prev and next link...
  I am using ASP.Net MVC 4 using these codes:</p>
  
  <p><strong>VIEW:</strong></p>
  
  <pre><code>&lt;div class="pagination"&gt;
      &lt;ul&gt;
          @for (int i = 1; i &lt;= ViewBag.PagesCount; i++)
          {
              &lt;text&gt;
                  &lt;li&gt;@Html.ActionLink(i.ToString(), "Index", new { pagee = i })&lt;/li&gt;
              &lt;/text&gt;
          }
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>CONTROLLER:</strong></p>
  
  <pre><code>int offset = 15;
  
  int pagecount = ((pagee - 1) * offset);
  
  int totalPages = 0;
  int totalItems = 0;
  
  try
  {       
      totalItems = requestform.Count();
      while (totalItems &gt; 0)
      {
          totalItems -= 15;
          totalPages++;
      }
      ViewBag.PagesCount = totalPages;
      return View(requestform.Skip(pagecount).Take(offset).ToList());
  }
  catch
  {
      while (totalItems &gt; 0)
      {
          totalItems -= 15;
          totalPages++;
      }
      ViewBag.PagesCount = totalPages;
      return View(requestform.Skip(pagecount).Take(offset).ToList());
  }
  </code></pre>
  
  <p>Please help me with this.</p>