title: MVC Radiobutton binding complex object
body: <p>I have MVC3 web application where we need to populate radio button list with validation. My Model is something like this:</p>
  
  <pre><code>public class EmployeesViewModel
  {
       public List&lt;Employee&gt; listEmployee { get; set; } //To persist during post
       public IEnumerable&lt;SelectListItem&gt; selectListEmployee { get; set; }
  
       [Required]
       public Employee selectedEmployee { get; set; }
  }
  
  public class Employee
  {
    public int ID {get; set;}
    public string Name {get; set}
    public string Department {get; set}
   }
  </code></pre>
  
  <p>I need to populate radiobutton list something like below:</p>
  
  <ul>
  <li>Employee1ID - Employee1Name - Employee1Department      // id - name - department</li>
  <li>Employee2ID  - Employee2Name - Employee2Department</li>
  <li>Employee3ID  - Employee3Name - Employee3Department</li>
  </ul>
  
  <p>Selected Employee should be stored into "selectedEmployee" field. What is the best or clean way to populate these radio button List in MVC3?</p>
  
  <p>Note: Mainly Looking for two task:
   1. storing "Employee" object in each "Input" radio button tag, so that selected employee will be saved to "selectedEmployee" field
   2. Best way to mark "Employee" object as required field</p>
  
  <p>Much appreciate your help!</p>
  
  <p>Thanks,</p>