我是mvc的新手,我有2个下拉列表,我需要先使用mvc 3绑定第二个。
代码示例
@<table>
<tr>
<td>
@Html.DropDownList("Brands", Model.Brands, "Select Brand", New With {.style = "width:150px;"})
</td>
</tr>
<tr>
<td>
@Html.DropDownList("Models", Model.Models, "Select Model", New With {.style = "width:150px;"})
</td>
</tr>
<tr>
<td>
@Html.DropDownList("Devices", Model.Devices, "Select Device", New With {.style = "width:150px;"})
</td>
</tr>
<tr>
<td>
@Html.DropDownList("Systems", Model.Systems, "Select System", New With {.style = "width:150px;"})
</td>
</tr>
</table>
我需要通过模型填充模型和填充设备。 任何帮助请... ..
由于
答案 0 :(得分:0)
在视图中:
{{2p> Lookup Utils是一个静态类:@Html.DropDownListFor( x => x.Model, new SelectList( LookupUtils.GetModelsList(Model.Brand), "Value", "Text", Model.Model))
要动态更新某些下拉列表,您应该使用jQuery-Collapse插件:http://github.com/danielstocks/jQuery-Collapse/