title: MVC 3, Radio buttons & Models
body: <p>Given I have a Model object like ...</p>
  
  <pre><code>public class MyModel
  {
    public int SomeProperty { get; set; }
    public int SomeOtherProperty { get; set; } 
  
    public IList&lt;DeliveryDetail&gt; DeliveryDetails { get; set; }
  }
  
  public DeliveryDetail
  {
     public string Description { get; set; }
     public bool IsSelected { get; set; }
  }
  </code></pre>
  
  <p>and I pass it through to a View like this ...</p>
  
  <pre><code>// Controller
  public ActionResult Index()
  {
    MyModel myModel = Factory.CreateModelWithDeliveryDetails(x);
    return View(myModel);
  }
  </code></pre>
  
  <p>How would I render / bind a set of radio buttons (in the view)?  Using the following code doesn't post the data back:</p>
  
  <pre><code>@foreach(var deliveryDetail in @Model.DeliveryDetails)
  {
     @deliveryDetail.Description
     @Html.RadioButtonFor(x =&gt; deliveryDetail, false)
  }
  </code></pre>