我是MVC和HTML的新手。我试图通过选择单选按钮来禁用或隐藏下拉列表。我不知道如何实现这一目标。我是初学者,不知道这一点。请帮助。 以下是我的代码..
<input onselect="" type="radio" style="width: 50px" name="name" id="rad1" checked="checked">
<label style="width: 100px;" for="rad1">Civil/Building</label>
<input onselect="" type="radio" style="width: 50px" name="name" id="rad2">
<label style="width: 100px" for="rad2">Electrical/Plumber</label>
@Html.DropDownListFor(model => model.BUILDING_CLASSIFICATION,
((List<CODE_TABLE>)Model.lstBuildingType)
.Select(m => new SelectListItem { Text = m.DISP_TEXT, Value = m.ID.ToString() }), new { @class = "col-xs-12 col-sm-4 select2 select3", @placeholder = "Classification" })
@Html.ValidationMessageFor(model => model.BUILDING_CLASSIFICATION)
@Html.DropDownListFor(model => model.CIVIL_CLASSIFICATION,
((List<CODE_TABLE>)Model.lstCivil)
.Select(m => new SelectListItem { Text = m.DISP_TEXT, Value = m.ID.ToString() }), new { @class = "col-xs-12 col-sm-4 select2", @placeholder = "Classification" })
@Html.ValidationMessageFor(model => model.CIVIL_CLASSIFICATION)
@Html.DropDownListFor(model => model.ELECTRICAL_CLASSIFICATION,
((List<CODE_TABLE>)Model.lstElectrical)
.Select(m => new SelectListItem { Text = m.DISP_TEXT, Value = m.ID.ToString() }), new { @class = "col-xs-12 col-sm-4 select2 select3", @placeholder = "Classification" })
@Html.ValidationMessageFor(model => model.ELECTRICAL_CLASSIFICATION)
@Html.DropDownListFor(model => model.PLUMBING_CLASSIFICATION,
((List<CODE_TABLE>)Model.lstPlumbing)
.Select(m => new SelectListItem { Text = m.DISP_TEXT, Value = m.ID.ToString() }), new { @class = "col-xs-12 col-sm-4 select2", @placeholder = "Classification" })
@Html.ValidationMessageFor(model => model.PLUMBING_CLASSIFICATION)