如何在MVC 2使用Html.EditorFor时设置外观字段顺序?
-
18-09-2019 - |
题
我有以下类在我的型号:
public abstract class Entity : IEntity
{
[ScaffoldColumn(false)]
public int Id { get; set; }
[Required,StringLength(500)]
public string Name { get; set; }
}
和
public class Model : SortableEntity
{
[Required]
public ModelType Type { get; set; }
[ListRequired]
public List<Producer> Producers { get; set; }
public List<PrintArea> PrintAreas { get; set; }
public List<Color> Colors { get; set; }
}
要显示在视图中的“模式” I类只需调用Html.EditorFor(型号=>模型),但是基类最后呈现时,这是不期望的行为的“名称”属性。
是否有可能以某种方式influenece显示的字段的订单?
解决方案
我已经无法找到一个属性,所以你的选择是:
1)创建一个,然后修改基地Object.ascx模板以考虑它,或 2)为您的类,明确提出的东西,在你想要的顺序自定义编辑器模板。
不隶属于 StackOverflow