title: How do I use the strongly-typed HTML helpers with nullable types?
body: <p>I want to use the strongly-typed HTML helpers in ASP.NET MVC 2 with a property of my model which is <code>Nullable&lt;T&gt;</code>.</p>
  
  <h3>Model</h3>
  
  <pre><code>public class TicketFilter {
      public bool? IsOpen { get; set; }
      public TicketType? Type{ get; set; } // TicketType is an enum
      // ... etc ...
  }
  </code></pre>
  
  <h3>View (HTML)</h3>
  
  <pre><code>&lt;p&gt;Ticket status:
    &lt;%: Html.RadioButtonFor(m =&gt; m.IsOpen, null) %&gt; All
    &lt;%: Html.RadioButtonFor(m =&gt; m.IsOpen, true) %&gt; Open
    &lt;%: Html.RadioButtonFor(m =&gt; m.IsOpen, false) %&gt; Closed
  &lt;/p&gt;
  &lt;p&gt;Ticket type:
    &lt;%: Html.RadioButtonFor(m =&gt; m.Type, null) %&gt; Any
    &lt;%: Html.RadioButtonFor(m =&gt; m.Type, TicketType.Question) %&gt; Question
    &lt;%: Html.RadioButtonFor(m =&gt; m.Type, TicketType.Complaint) %&gt; Complaint
    &lt;!-- etc --&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>However, using the helpers in this way throws an <code>ArgumentNullException</code> -- the second parameter cannot be null. Instead of <code>null</code>, I've tried using <code>new bool?()</code>/<code>new TicketType?</code> as well as <code>String.empty</code>. All result in the same exception. How can I work around this and bind a control to a null value?</p>