title: Using Ajax Form and Pagination - losing search parameters on next page selection
body: <p>Ok - someone must have done this before me.</p>
  
  <p>I have a an Ajax form (Ajax form helper) that has a search box and some checkboxes to filter stuff.  The search results are rendered beneath by way of a partial view.  See below:</p>
  
  <p><img src="https://i.stack.imgur.com/MgJ3S.png" alt="enter image description here"></p>
  
  <p>Here is the code:</p>
  
  <p><strong>Search.cshtml</strong></p>
  
  <pre><code>@using (Ajax.BeginForm("SearchStuff", "FooController", new AjaxOptions
  {
      InsertionMode = InsertionMode.Replace,
      HttpMethod = "GET",
      OnFailure = "searchFailed",
      LoadingElementId = "progress",
      UpdateTargetId = "search-results",
  }))
  {
      &lt;div&gt;
          &lt;div class="search-filter"&gt;
              &lt;span class="searchFilter"&gt;          
                  &lt;input type="checkbox" name="chkAll" checked /&gt;
                  All
                  &lt;input type="checkbox" name="chkJournal" /&gt;
                  Journal
                  &lt;input type="checkbox" name="chkBook" /&gt;
                  Book
                  &lt;input type="checkbox" name="chkBookChapter" /&gt;
                  Book Chapter
                  &lt;input type="checkbox" name="chkReport" /&gt;
                  Report
                  &lt;input type="checkbox" name="chkWebsite" /&gt;
                  Website
                  &lt;input type="checkbox" name="chkPersComm" /&gt;
                  Personal Comm
                  &lt;input type="checkbox" name="chkConference" /&gt;
                  Conference
                  &lt;input type="checkbox" name="chkMap" /&gt;
                  Map
                  &lt;input type="checkbox" name="chkThesis" /&gt;
                  Thesis 
              &lt;/span&gt;
          &lt;/div&gt;
  
          &lt;div class="searchbox"&gt;
              &lt;input type="search" name="q" autocomplete="off"/&gt;
              &lt;input class="submit-button" type="submit" value="Search" /&gt; 
          &lt;/div&gt; 
      &lt;/div&gt;
  }
  
  &lt;div id="search-results" class="search-results"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Problem with Pagination</strong></p>
  
  <p>I have now started to try and get a bit clever and I have included an Ajax Pager to have pagination returned in the first set of search results.</p>
  
  <p><img src="https://i.stack.imgur.com/QqlYT.png" alt="enter image description here"></p>
  
  <p>Problem is, I have to retain all values in the ajax search form when the user selects the next page to render, but when I debug back at the SearchStuff method in FooController - it doesn't know anything about the search parameters.  Can anyone suggest what I should do to send the search parameters on?  </p>
  
  <pre><code>&lt;div class="pager"&gt;
      @Html.Raw(
          Ajax.Pager(new AjaxOptions
          {
              UpdateTargetId = "search-results",
              OnBegin = "beginPaging",
              OnSuccess = "successPaging",
              OnFailure = "failurePaging"
          },
                        Model.PageSize,
                        Model.PageNumber,
                        Model.TotalItemCount,
  
  
                        new { controller = "FooController", action = "SearchStuff"})
      )
  &lt;/div&gt;
  </code></pre>