how to render base properties first

Vote:
 

I have a base class with two properties(display and value) and the child class(inherits the base class) with two properties(message summary and information).

public class baseclass

{

public string Display {get; set;}

public string Value {get; set;}

}

public class childclass : baseclass

{

public string Messagesummary{get; set;}

public string Information {get; set;}

}

In the CMS, the child class properties are rendered first followed by the base class. But I want
base class properties to appear first followed by base class

#152011
Aug 12, 2016 10:15
Vote:
 

I suppose you could use the Order property in the Display attribute:

[Display(
Order = 320)]

#152012
Aug 12, 2016 10:20
Vote:
 

I cannot use order in the base class because it's being referenced in many other classes. I have tried using order in the child class as below but no luck.

public class childclass : baseclass

{

[Display(

Order=100)]

public string Messagesummary{get; set;}

[Display(

Order=200)]

public string Information {get; set;}

}

#152013
Aug 12, 2016 10:43
Vote:
 

You could override the properties in the child classes and add the order value there

#152015
Aug 12, 2016 10:48
Vote:
 

You can also change the order in Admin, but then it overwrites what you have in your code. Another approach would be to define those properties in an interface, then have multiple implementations and/or base classes.

#152020
Aug 12, 2016 13:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.