title: Razor EditorFor with Onclick Event
body: <p>I have nullable Boolean value that is being presented as a checkbox using the following code:</p>
  
  <pre><code>@Html.EditorFor(m =&gt; m.IsInitialStatus, new { htmlAttributes = new { @onclick = "InitialOrStarting()" } })
  </code></pre>
  
  <p>however the @onclick attribute is not being added to the HTML when the page is loaded. Am I missing something here? I had taken the example from an answer on this <a href="https://stackoverflow.com/questions/20700734/razor-editorfor-checkbox-event-binding">page</a>.</p>
  
  <p>I have also looked at changing this to a CheckBoxFor but keep getting an issue with the nullable Bool datatypes.</p>
  
  <p>Any help on this would be appreciated! I just want a nullable bool checkbox with an onClick event firing to a Javascript function... I am not the most advanced user but this seems to be more difficult for me to do than maybe it should!?</p>
  
  <p>EDIT</p>
  
  <p>There appears to be an EditorTemplate for Boolean which contains:</p>
  
  <pre><code>@model bool?
  
  @Html.CheckBox("", Model.GetValueOrDefault())
  </code></pre>