Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
The properties are virtual, so yes, you can override them.
But I would suggest to multiply SortOrder by 100 (or something else) for each super class and start on 100 in your base class. So:
public class BaseContentPage : PageData
{
[Display(Name = "Innehåll", GroupName = SystemTabNames.Content, Order = 100)]
public virtual ContentBlock MainContent { get; set; }
[Display(Name = "Listning", GroupName = Global.CustomTabName.Listing, Order = 110)]
public virtual ListingBlock Listing { get; set; }
}
public class EventPageType : BaseContentPage
{
[CultureSpecific]
[Display(
Name = "Startdatum",
Description = "Datum då evenamanget startar",
GroupName = SystemTabNames.Content,
Order = 80)]
public virtual DateTime StartDate { get; set; }
[CultureSpecific]
[Display(
Name = "Slutdatum",
Description = "Datum då evenemanget slutar",
GroupName = SystemTabNames.Content,
Order = 90)]
public virtual DateTime EndDate { get; set; }
[Display(Order = 200)]
public virtual string Property1 { get; set; }
[Display(Order = 210)]
public virtual string Property2 { get; set; }
}
Say I created a pagetype class which inherit from a baseclass which includes a property whos DisplayAttribute is set to 1.
Could i then access this propertys attribute and change to Order value in some way?
This is how my baseclass looks like:
public class BaseContentPage : PageData
{
[Display(Name = "Innehåll", GroupName = SystemTabNames.Content, Order = 1)]
public virtual ContentBlock MainContent { get; set; }
[Display(Name = "Listning", GroupName = Global.CustomTabName.Listing, Order = 2)]
public virtual ListingBlock Listing { get; set; }
}
and this is my new pagetype
public class EventPageType : BaseContentPage
{
[CultureSpecific]
[Editable(true)]
[Display(
Name = "Startdatum",
Description = "Datum då evenamanget startar",
GroupName = SystemTabNames.Content,
Order = 1)]
public virtual DateTime StartDate { get; set; }
[CultureSpecific]
[Editable(true)]
[Display(
Name = "Slutdatum",
Description = "Datum då evenemanget slutar",
GroupName = SystemTabNames.Content,
Order = 2)]
public virtual DateTime EndDate { get; set; }
}
So lets say i wanted StartDate and EndDate in my new pagetype to be displayed before the ContentBlock of my baseclass. Is this possible?