title: asp.net mvc3 checking radio button based on model
body: <p>I have a seemingly easy task of setting a radio button "checked" based on model's boolean value. I have a boolean in my model "IsSDPDonor" which I want to use it for Yes/No Radio buttons. The "Yes" radio button should be checked if "IsSDPDonor" is true and "No" radio button when it is false. I tried to use the code below but it always checks the "No" radio button.</p>
  
  <pre><code> @Html.Label("Would You Like to Donate Platelets (SDP)") : 
   @Html.RadioButtonFor(m =&gt; m.Donor.IsSDPDonor, true, new {@checked = Model.Donor.IsSDPDonor ? "checked" : ""}) Yes 
   @Html.RadioButtonFor(m =&gt; m.Donor.IsSDPDonor, false, new { @checked = !Model.Donor.IsSDPDonor ? "checked" : "" }) No
  </code></pre>
  
  <p>I was getting a little frustrated, so I thought that I would rather take some help. Basically, the HTML syntax says to put only the "Checked" attribute without any values to check a radio button. I was wondering how would I do that using MVC3 razor syntax.</p>