DisplayAttribure.Order in derived class RRS feed

  • Question

  • 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
    Friday, November 28, 2014 11:30 AM


  • HI Gilbert,

    Order attribute Gets or sets the order weight of the column ref from msdn, but this will not help to arrange columns in datagrid.

    if you want them to be in sequence then declare them in sequence.

    Thanks & Regards
    Syed Amjad Sr. Silverlight/WPF Developer,
    yahoo : syedamjad6736@yahoo.com, skype : syedamjad.0786.
    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    • Marked as answer by Barry Wang Friday, December 5, 2014 11:28 AM
    Monday, December 1, 2014 8:20 AM