title: Unable to apply paging in mvc4 when using viewmodel and actionlink
body: <p>Hi I have one link button. When i clicked on link button number of records will be displayed. I want to apply paging for that. I have tried as below.</p>
  
  <p>Index.cshtml </p>
  
  <pre><code>@foreach (var group in Model.records)
  {
      &lt;tr&gt;                    
          &lt;td&gt;@Html.ActionLink(@group.clientId.ToString(), "detailsbyClientId", "DocumentVerification", new { clientId = @group.clientId.ToString()},null)&lt;/td&gt;
          &lt;td&gt;@group.clientName&lt;/td&gt;
          &lt;td&gt;@group.Count&lt;/td&gt;
      &lt;/tr&gt;
  }
  </code></pre>
  
  <p>This is my controller code.</p>
  
  <pre><code>public ActionResult detailsbyClientId(int? clientId, int currentFilter, int? page)
  {
      if (clientId != null)
      {
          page = 1;
      }
      else
      {
          clientId = currentFilter;
      }
      ViewBag.CurrentFilter = clientId;
      int pageSize = 8;
      int pageNumber = (page ?? 1);
      documentVerificationBAL objBAL = new documentVerificationBAL();
      int cId = Convert.ToInt32(clientId);
      List&lt;detailsbyClientId&gt; detailsbyclient = objBAL.detailsbyclient(cId);
      IPagedList&lt;detailsbyClientId&gt; pagedLog = detailsbyclient.ToPagedList(pageNumber, pageSize);
  
      detailsbyclientIdviewModel model;
      model = new detailsbyclientIdviewModel()
      {
          detailsbyclientId = pagedLog
      };
      return View("detailsbyClientId", model);
  }
  </code></pre>
  
  <p>This is my viewcode</p>
  
  <pre><code>@model  PagedList.IPagedList&lt;c3card.DAL.detailsbyclientIdviewModel&gt;
  @using PagedList.Mvc;
  @if(!Model.detailsbyclientId.Any())
  {
  &lt;div&gt;
      &lt;table width="100%" border="0" cellspacing="0" cellpadding="0" class="dataTable tableHover"&gt;
          &lt;tr&gt;
              &lt;th&gt;Corporate Name&lt;/th&gt;
              &lt;th&gt;employee ID&lt;/th&gt;
              &lt;th&gt;employee Name&lt;/th&gt;
              &lt;th&gt;Nationality&lt;/th&gt;
              &lt;th&gt;Document Type&lt;/th&gt;
              &lt;th&gt;Actions&lt;/th&gt;
          &lt;/tr&gt;
          @foreach (var group in Model.detailsbyclientId)
          {
              &lt;tr&gt;
                  &lt;td&gt; @group.clientName &lt;/td&gt;
                  &lt;td&gt; @group.employeeId &lt;/td&gt;
                  &lt;td&gt; @group.employeeName &lt;/td&gt;
                  &lt;td&gt; @group.documentType &lt;/td&gt;
                  &lt;td scope="col"&gt;
                      &lt;input type="button" class="btn btn-primary btn-cons" value="View Document" onclick="showDocumentData('@group.upld_Id');" /&gt;
                  &lt;/td&gt;
                  &lt;td scope="col"&gt;
                      &lt; input type="button" class="btn btn-primary btn-cons" value="Approve" onclick="showDocumentData('@group.upld_Id');" /&gt;
                  &lt;/td&gt;
                  &lt;td scope="col"&gt;
                      &lt; input type="button" class="btn btn-primary btn-cons" value="Reject" onclick="showDocumentData('@group.upld_Id');" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          }
      &lt;/table&gt;
  
      @Html.PagedListPager(Model, page =&gt; Url.Action("detailsbyClientId",
      new { page, currentFilter = ViewBag.CurrentFilter, pageSize = 5 }))
      Page @(Model.PageCount &lt; Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
  &lt;/div&gt;
  }
  </code></pre>
  
  <p>my viewmodel</p>
  
  <pre><code>public class detailsbyclientIdviewModel
      {
          public int upldId { get; set; }
          public IEnumerable&lt;detailsbyClientId&gt; detailsbyclientId { get; set; }
          public IEnumerable&lt;Metadata&gt; metadata { get; set; }
      }
  </code></pre>
  
  <p>I am sending clientid to detailsbyclientid action method. How can I send <code>clientid</code> as <code>currentfilter</code> from actionlink? I am getting nullable error currently because I am not sending current filter. Let me know if I am wrong in any place. Thank you lot</p>