我有下面的模型说F:可枚举对象MVC4
public partial class F
{
[Key, Display(Name = "Id")]
public int FId { get; set; }
public int RId { get; set; }
public int FTId { get; set; }
public string C { get; set; }
public string U { get; set; }
public string D { get; set; }
[ScaffoldColumn(false)]
public System.DateTimeOffset Created { get; set; }
}
在控制器我必须从数据库中读取的“F”的所有记录,并指定那些记录的一个枚举列表。
对于前:
ViewBag.Cs = enumerable C column items (textbox)
ViewBag.Us= enumerable U column items (textbox)
ViewBag.FTIDs = enumerable FTId column items (this has to be a dropdown)
在我我必须表明
@Html.Textbox(Cs);
@Html.Dropdown(FTIDs);
我只给了文本框和dropdows作为一个例子,有可能像日期时间,复选框等许多其他控件, 我应该能够将每列写入viewbag列表并在MVC视图中显示它。
有人可以建议,如果这可以实现和如何?
非常感谢......