当我从另一个DropList.For中选择一个项目时,我正在尝试填充DropList.For。到目前为止,这是我的代码:
@Html.LabelFor(m => m.Cliente, new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.SelectedCategoryId,
new SelectList(Model.Cliente, "CategoryId", "CategoryName"), "- Please Select -")
@Html.ValidationMessageFor(x => x.Cliente, null, new { @class = "label label-danger" })
@Html.LabelFor(m => m.Tipo_servicio, new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.SelectedCategoryId,
new SelectList(Model.Tipo_servicio, "CategoryId", "CategoryName"), "- Please Select -")
@Html.ValidationMessageFor(x => x.Tipo_servicio, null, new { @class = "label label-danger" })
因此,我将其保存在视图中并用EntityFramework填充
答案 0 :(得分:0)
您可以使用“ onChange”事件,可以检查以下链接。
对多个Dropdown使用相同的方法: same method for multiple ddl
不同下拉菜单的不同方法: enter link description here
谢谢