标签:editorfor
-
使用ASP.NET MVC在View的EditorFor()方法中显示ViewBag的值 - c#
这可能是我的语法错误,但是我无法在我的视图中使用EditorFor为ViewBag设置默认值。 我检查了ViewBag.FirstName中的值是否正确传递,这很好。但是,该字段显示为无值。 我的声明是: @Html.EditorFor(model => model.Person.FirstName, new { htmlAttributes = ne […]
-
构建MVC3 EditorFor模板时,是否可以访问DataAnnotations? - c#
假设我有一个视图模型,其属性看起来像这样: [Required] [Display(Name = "Your name")] public string Name { get; set; } 我想构建一个看起来像这样的EditorFor模板: <label> @Model.DisplayName @if (Model.Requ […]