title: MVC Pair Checkbox with Text Input Field
body: <p>I'm looking to have something like the following:</p>
  
  <pre><code>@foreach(var option in ViewBag.OptionsAvailable)
  {
          //the 'option' variable will be used in these fields, of course
          &lt;input type='checkbox' name='thingToUse' /&gt;
          &lt;input type='text' name='textToSaveForThing' /&gt;
  }
  </code></pre>
  
  <p><code>ViewBag.OptionsAvailable</code> can be of variable length. <strong>I would like to take one of these options and add it to <code>Model.Options</code> with the saved value IF its checkbox is selected.</strong> The idea here is that, on the <code>HttpPost</code> controller method, I want to only acknowledge/save the value in the textbox if its corresponding checkbox is selected. What's the best way to approach this? </p>
  
  <p>I've come across <a href="http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx/" rel="nofollow">this explanation</a> of binding to a list, but I'm not sure how to evolve upon that to create what I want.</p>