在mvc视图中将editorfor值分配给radiobutton

时间:2015-01-15 12:35:39

标签: asp.net-mvc model

我有一个场景,我有3个单选按钮,其中两个有默认值,而第三个我希望它应该被分配一个文本框的值。我如何在下面实现这一点是我的一些代码:

<tr>
  <td>
    <label style="padding-bottom:0.5em;font-size:1em">
      @Html.RadioButtonFor(model => model.LicenseValidityDuration, "0", new { style = "width:2em" })
      Never
    </label>
  </td>
  <td></td>
</tr>
<tr>
  <td>
    <label style="padding-bottom:0.5em;font-size:1em">
      @Html.RadioButtonFor(model => model.LicenseValidityDuration, "-1", new { style = "width:2em" })
      Always
    </label>
  </td>
  <td></td>
</tr>
<tr>
  <td>
    <label style="padding-bottom:0.5em;font-size:1em">
      @Html.RadioButtonFor(model => model.LicenseValidityDuration, model => model.LicenseValidityDuration, new { style = "width:2em" })
      Days Before Expiry
    </label>
  </td>
  <td>
    @Html.EditorFor(model => model.LicenseValidityDuration)
  </td>
</tr>

0 个答案:

没有答案