title: WebGrid filter checkbox values lost on page change
body: <p>I'm using WebGrid and View Model in my MVC application. My Viewmodel has a int[ ] member called '<strong>companiesfilter</strong>' to take user's multiple selection from a company checkbox list to search a product database. </p>
  
  <p>The ViewModel will be sent to controller by Ajax.BeginForm, and controller will return the SAME viewmodel with a product list to populate a partial view which is mainly a Webgrid and paged (server side paging). </p>
  
  <p>It works well when I check some boxes, click the submit button, and get the result correctly. The problem is, when I click next page in WebGrid, it lost my multiselected values in <strong>companiesfilter</strong> on Controller side.</p>
  
  <p>By debuging, I found that the View did send back <strong>companiesfilter</strong> with the data correctly, but MVC failed to bind the data when populate the viewmodel for controller. Could anyone tell me why?</p>
  
  <p>The most interesting thing is, if I change companiesfilter to be string[ ], it works. HOWEVER, when Webgrid do paging, MVC feed the companiesfilter[0] with "1, 4, 5", not I supposed companiesfilter[0] = "1", companiesfilter[1] = "4", companiesfilter[2] = "5". Why it behaves like this?</p>
  
  <p>Any suggestions to solve this issue? I prefer to use int[ ], not string[ ]. Thanks!</p>
  
  <p>Here is my code for reference.</p>
  
  <pre><code>public class ProductSearchViewModel
  {
      public List&lt;Company&gt; CompanyFullList { get; set; }
      public int[] CompaniesFilter { get; set; }
      //Search Result
      public IEnumerable&lt;ProductInfor&gt; ProductList { get; set; }
  }
  
  public ActionResult M_ProductSearchIndex(ProductSearchViewModel searchViewModel)
  {
      search database...
  
      if (Request.IsAjaxRequest())
      {
          return PartialView("_M_ProductSearchResult", searchViewModel);
      }
      else
      {
          return View(searchViewModel);
      }        
  }
  </code></pre>
  
  <p>My view:</p>
  
  <pre><code>@model MyApp.Models.ViewModels.ProductSearchViewModel
  &lt;div id="CompaniesChkboxs"&gt;
  @foreach (var company in Model.CompanyFullList)
  {
      &lt;input type="checkbox" name="CompaniesFilter" value="@company.Id", @(Html.Raw(company.Selected ? "checked=\"checked\"" : "")) /&gt; @company.CompanyName
  }
  &lt;/div&gt;
  
  @Html.Partial("_U_ProductSearchResult", Model)
  </code></pre>