When I have just a standard class & I want to change the ordering of the columns, I use annotations:
[Display(Order=2)]
public string str1 { get; set }
[Display(Order=1)]
public string str2 { get; set; }
I just tried this with derived classes:
public class BaseClass
{
[Display(Order=1)]
public string str1 { get; set; }
[Display(Order=3)]
public string str2 { get; set; }
}
public class DerivedClass : BaseClass
{
[Display(Order=4)]
public string str3 { get; set; }
[Display(Order=2)]
public string str4 { get; set; }
}
My grid columns were: str1 str4 str2 str3 as expected.
[EDIT]
Needed to include a using declaration:
using System.ComponentModel.DataAnnotations;
to use [Display...]
I really enjoy working with both the gridview & the dataform. Most people hate hate hate the dataform. Its taken many frustrating hours to understand how to make it fit/work within our LOB apps, but now it's incredibly powerful and blazing fast for UI dev.
Also - if you're not familiar with Data Annotations, they're absolutely rad. You can set attributes like [Required(true)], [Display(Name="String 3")], [StringLength(3,ErrorMessage="This field can not exceed 3 characters in length")], Range(0,10,ErrorMessage="Must be 0-10)")] etc etc. The validation errors auto bubble up to the UI. They've saved seriously crazy amounts of time in our dev process.
[/EDIT]