问题描述
控制器
public ActionResult ItemInsert()
{
ViewBag.Category = new SelectList(db.CategoryMasters.ToList(),"CategoryId","CategoryName");
ItemViewModel item = new ItemViewModel();
return PartialView(item);
}
查看
<div class="form-group">
@Html.LabelFor(model => model.CategoryId,htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownList("Category",ViewBag.Category as SelectList,new { @id = "catagory" })
@Html.ValidationMessageFor(model => model.CategoryId,"",new { @class = "text-danger" })
</div>
</div>
如何使用javascript保存下拉列表值?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)