title: What determines if a field will be in the ViewData.ModelState Dictionary?
body: <p>Some background to my question:</p>
  
  <p>I am building a wizard style interface in ASP.Net MVC 4 that fills the properties of an object one page at a time.  I use DataAnnotation attributes to specify my business rules and defined what a valid, filled-out object looks like.</p>
  
  <p>One complication that comes from this is validation.  Since it takes several steps to completely fill out the object and make it valid, I have to validate each of the fields set by each step manually.  </p>
  
  <p>This ends up looking like this in my controller class:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Step1(MyBigModel m)
  {
      if (ViewData.ModelState["Field1"].Errors.Count() == 0
          &amp;&amp; ViewData.ModelState["Field2"].Errors.Count() == 0)
      {
          repository.saveStep1(m);
          return RedirectToAction("Step2", new { myId= m.myId});
      }
      else
          return View(m);
      }
  }
  </code></pre>
  
  <p>The annoyance with this approach is that the fields I want to check are not always in the ModelState dictionary!  If there is a validation error, the field will be in the dictionary.  However, if it is valid, it may or may not be in the dictionary.</p>
  
  <p>It seems like some input types work better than others--textboxes seem to be fairly consistent, whereas checkboxes never show up.  I haven't been able to figure out a consistent rule set for predicting when they'll be in there, nor have I found any relevant documentation.</p>
  
  <p>So, my question is, what determines if a field will be in the ViewData.ModelState Dictionary?</p>