【发布时间】:2017-09-20 03:42:38
【问题描述】:
我想为语言选择创建一个下拉菜单。它是一个 MVC 数据库应用程序。我希望用户能够选择多种语言。
我想知道如何将我的模型连接到剃刀视图。在类的属性之上我可以使用什么样的属性?
这是我拥有的模型类的快照:
public class CrewViewModel
{
// This is the date of birth property
[Required]
[DisplayName("Date of Birth")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-dd-mm}", ApplyFormatInEditMode = true)]
public DateTime DOB { get;
// Here goes the code for the Languages property
}
以及在视图中使用什么剃须刀代码。
【问题讨论】:
标签: c# asp.net-mvc asp.net-mvc-4 razor