DisplayAttribute.Order in Derived class
-
class Base
{
[Display(Order = 0)]
public int FirstProp {get;set;}[Display(Order = 1)]
publuc string SecondProp {get; set;}
}class Derived : Base
{
[Display(Order = 2)]
public string ThridProp {get;set;}
}I was expecting that the properties will have an order like this | FirstProp | SecondProp | ThirdProp | But I was getting like this | ThridProp | FirstProp | SecondProp | What was i missed? BTW i was binding it in a gridview. I will appreciate for any help will come. Thank you
-
class Base
{
[Display(Order = 0)]
public int FirstProp {get;set;}[Display(Order = 1)]
publuc string SecondProp {get; set;}
}class Derived : Base
{
[Display(Order = 2)]
public string ThridProp {get;set;}
}I was expecting that the properties will have an order like this | FirstProp | SecondProp | ThirdProp | But I was getting like this | ThridProp | FirstProp | SecondProp | What was i missed? BTW i was binding it in a gridview. I will appreciate for any help will come. Thank you
I'm not familiar with the GridView, but the behaviour looks like its started with fields in the derived class before moving onto the base class. If that's the case, that's a pretty dumb implementation.
-
I'm not familiar with the GridView, but the behaviour looks like its started with fields in the derived class before moving onto the base class. If that's the case, that's a pretty dumb implementation.
What is your suggestion? Actually i am just using auto-implemented property and i am not using any fields.
-
class Base
{
[Display(Order = 0)]
public int FirstProp {get;set;}[Display(Order = 1)]
publuc string SecondProp {get; set;}
}class Derived : Base
{
[Display(Order = 2)]
public string ThridProp {get;set;}
}I was expecting that the properties will have an order like this | FirstProp | SecondProp | ThirdProp | But I was getting like this | ThridProp | FirstProp | SecondProp | What was i missed? BTW i was binding it in a gridview. I will appreciate for any help will come. Thank you
-
Yeah you're right. But in msdn documentation that DisplayAttribute.Order[^] can change the order of the properties. And i tried it but no success.
-
Yeah you're right. But in msdn documentation that DisplayAttribute.Order[^] can change the order of the properties. And i tried it but no success.
-
Yes, its is