如何使用来自我的数据库的值在我的视图中创建多个下拉列表?我可以得到一个下拉菜单,但如何添加另一个?
public class MyModel
{
public Category Category { get; set; }
public IEnumerable<SelectListItem> List { get; set; }
}
public ActionResult Page()
{
var query = model.MyModel.Select(c => new SelectListItem
{
Value = c.ModelDescription,
Text = c.ModelDescription
});
var model = new MyModel
{
List = query.AsEnumerable()
};
return View(model);
}