我正在开发MVC4&实体框架Application.I想要填充DropDownList,我想将Category List绑定到Dodropdown列表
IRepository Code
IList<Category> GetCategory();
知识库
public IList<Category> GetCategory() { return (from c in context.Categories select c).ToList(); }
调节器
public IList<Category> GetCategory() { return icategoryRepository.GetCategory(); }
之后我就在这里.如何将数据绑定到Dropdownlist?
<label for="ProductType">Product Type</label> @Html.DropDownListFor(m => m.ProductType,new List<SelectListItem>)
我的控制器代码
public ActionResult AddProduct() { return View(); }
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。