title: Why ModelState.IsValid always return false in mvc
body: <p>In my controller this code:</p>
  
  <pre><code>[HttpPost]
          public ActionResult Edit(Company company, FormCollection IsCostCenters)
          {
              if (ModelState.IsValid)
              {
                  Company objNewCompany = new Company();
                  //oParty.CostCenters.Clear();
  
                  using (PaymentAdviceEntityContainer db1 = new PaymentAdviceEntityContainer())
                  {
                      objNewCompany = db1.Companies.Find(company.Id);
  
                      objNewCompany.CostCenters.Clear();
  
                      string[] temp = IsCostCenters["CostCenters"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                      foreach (var s in temp)
                      {
                          if (s != "false")
                          {
  
                              CostCenter oCostCenter = new CostCenter();
                              oCostCenter = db1.CostCenters.Find(Convert.ToInt32(s));
                              objNewCompany.CostCenters.Add(oCostCenter);
                          }
                      }
                      db1.SaveChanges();
                  }
  
                  db.Entry(company).State = EntityState.Modified;
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
              ViewBag.CreatedById = new SelectList(db.Employees, "Id", "FirstName", company.CreatedById);
              return View(company);
          }
  </code></pre>
  
  <p>And my view  code as below</p>
  
  <pre><code>@using PaymentAdviceEntity;
  @{
  
      ViewBag.Title = "Edit";
      List&lt;CostCenter&gt; clist = new List&lt;CostCenter&gt;();
      clist = ((List&lt;CostCenter&gt;)ViewBag.CostCenters).ToList();
  }
  
  
  
                         &lt;div style="line-height: 22px; width: 100%;height :3%; float: left; "&gt;
                         @{
      foreach (var item in clist)
      {                      
                               &lt;div  style="line-height: 22px; width: 28%; float: left;"&gt;
                                                  &lt;span class="checkbox"&gt;@Html.CheckBox("CostCenters", item.IsChecked, new { @value = item.Id })&lt;/span&gt;
                                                 &lt;span&gt;@Html.DisplayFor(modelItem =&gt; item.Name)&lt;/span&gt;
  
                                &lt;/div&gt; 
  
      }
  }
  </code></pre>
  
  <p>So please what is reason <code>ModelState.IsValid</code> is return false in page post time ...</p>