title: ASP.NET MVC using bool value for radio button checked property
body: <p>Basically I want my radio buttons to be checked depending on a value from my model view control, below is some sample code and my attempt so far:</p>
  
  <pre><code>  &lt;tr&gt;
                  &lt;td&gt;
                  &lt;label for="brakepads" class="label3"&gt;Brake Pads:&lt;/label&gt;&lt;/td&gt;
                  &lt;%= Html.TextBox("brakepads", Model.brakepads, new {style="display:none" })%&gt;
                  &lt;%= Html.ValidationMessage("brakepads", "*") %&gt;
  
                  &lt;td&gt;&lt;label for="brakefluid" class="label4" &gt;Passed:&lt;/label&gt;
                  &lt;asp:RadioButton ID="RadioButton15" runat="server" GroupName="b" value="True" Checked="&lt;%= Model.brakepads.Value %&gt;" onclick="brakepads.value=(this.value)" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;label for="brakefluid"  class="label4" &gt;Failed:&lt;/label&gt;
                  &lt;asp:RadioButton ID="RadioButton16" runat="server" GroupName="b" value="False" Checked="&lt;% Model.brakepads.Value %&gt;" onclick="brakepads.value=(this.value)"/&gt;&lt;/td&gt;
                  &lt;/tr&gt;
  </code></pre>
  
  <p>I get the following at runtime: Cannot create an object of type 'System.Boolean' from its string representation '&lt;%= Model.brakepads.Value %>' for the 'Checked' property.</p>
  
  <p>I tried using (bool) to cast, but that didn't work either, so I'm unsure of what to do next. My only concern is that occasionally the bool will be null, if that won't break functionality then it's fine.</p>