title: ASP MVC binding two controls to one field
body: <p>In my view model I have a field. This field can be selected from a drop down list or entered in a textbox. I have two radio buttons which allows to select between drop and textbox.</p>
  
  <pre><code>&lt;div class="frm_row" id="contractorRow"&gt;
      @Html.RadioButton("IsContractorNew", "false", true)
      @Html.Label(@Resources.SomeLabels.Existing)
      @Html.RadioButton("IsContractorNew", "true", false)
      @Html.Label(@Resources.SomeLabels.New)
      &lt;div class="frm_row_input" id="contractorDropDownList"&gt;
          @Html.DropDownListFor(model =&gt; model.CONTRACTOR, Model.Contractors)
          @Html.ValidationMessageFor(model =&gt; model.CONTRACTOR)
      &lt;/div&gt;
      &lt;div class="frm_row_input" id="contractorTextBox" style="display: none;"&gt;
          @Html.TextBoxFor(model =&gt; model.CONTRACTOR)
          @Html.ValidationMessageFor(model =&gt; model.CONTRACTOR)
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I prepared a javascript code for hiding, showing and clearing controls while selecting radio buttons. The problem is - field is bound only to the first control (drop down list).</p>
  
  <p>EDIT:</p>
  
  <p>I solved this problem by creating one hidden field and scripting whole logic to bind active control with it and therefore with the model. Anyway if anyone knows simpler solution, please post it.</p>