我在填写asp.net mvc 5中的下拉列表时遇到问题。所以我在我看来有这个
@using (Html.BeginForm("Getdata", "Data", FormMethod.Get))
{
<p>
Choose your type of data: @Html.DropDownList("SearchString") <br />
<input type="submit" value="Filter" />
</p>
}
这是控制器方法
public JsonResult Getdata(string search)
{
var data = (from m in db.ABC
select search).Distinct();
return Json(data, JsonRequestBehavior.AllowGet);
}
这就是模型
public class ABC
{
public int a { get; set; }
public int b { get; set; }
public int c { get; set; }
public string Name { get; set; }
public string Type { get; set; }
public int ID { get; set; }
public class ABCDBContext : DbContext
{
public DbSet<ABC> ABC { get; set; }
}
}
那么我需要更改什么来填充ABC具有的数据类型的下拉列表?