我在我的模型以下类:在MVC 2中使用Html.EditorFor时如何设置字段的外观顺序?
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(型号=>模型),但是基类的“名称”属性最后呈现,这不是所需的行为。
是否有可能以某种方式显示显示字段的顺序?
这里有一个体面的解决方案http://blog.maartenballiauw.be/post/2010/01/11/Ordering-fields-in-ASPNET-MVC-2-templated-helpers.aspx – duckworth 2010-05-26 20:40:33