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

Recommended Answers

All 3 Replies

Try setting the order weights to a negative number in your base class.

sorry but, setting order weights to negative has no success.

Have you tried making the properties in the base class virtual?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.