仅当选中复选框时,如何才能显示下拉列表?

时间:2019-07-01 11:16:12

标签: html asp.net-mvc razor

<div class="form-group">
        @Html.LabelFor(model => model.Boolmainindex, "Main Topic",htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.CheckBoxFor(model => model.Boolmainindex, new
            {
               htmlAttributes = new { @class = "form-control", @checked = true }
            })
            @Html.ValidationMessageFor(model => model.Boolmainindex, "", new { @class = "text-danger" })
        </div>
    </div>
<div class="form-group" disabled >
        @Html.Label("Main Headings", htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10" disabled>
            @Html.DropDownList("InductionID", "Select a topic")
        </div>
    </div>

我希望“主要标题”下拉列表仅在选中“ Boolmainindex”复选框时显示,但似乎找不到方法。

0 个答案:

没有答案