IIS, Outlook RPC, and things you just can’t test for.
Sorting a GridView Using ObjectDataSource, custom classes, and reflection, part 2
In part 1, I covered how to create an IComparer class that uses reflection to sort a list of objects based on a specified property name. While that’s the underlying mechanics that powers our GridView sorting solution, we still need a convenient way to hook it up to a GridView. And so, I extended the GridView class to create the ODSSortableGridView class that does just this.
Continue reading
In part 1, I covered how to create an IComparer class that uses reflection to sort a list of objects based on a specified property name. While that’s the underlying mechanics that powers our GridView sorting solution, we still need a convenient way to hook it up to a GridView. And so, I extended the GridView class to create the ODSSortableGridView class that does just this.
Sorting a GridView Using ObjectDataSource, custom classes, and reflection, part 1
As I’ve mentioned before, I had to figure out early on the cleanest way of populating a GridView, and my choices were down to using TableAdapters/DataTables and business objects. While writing your own classes seems (to me, at least) to be the nicer way of structuring your program–if done right, it forces you to put all of the rules for handling data in its own tier–it gets a bit ugly when you have to hook up your custom classes to some of .NET’s built-in controls. Specifically, it starts getting to be a hassle once you realize that all the automagic goodness of GridView is a product of using the DataTable, and that sorting a list of objects on one member requires writing a whole new custom class per member. Maybe it’s the two and a half years of Python programming talking, but it seemed like there had to be a better way.
Continue reading
As I’ve mentioned before, I had to figure out early on the cleanest way of populating a GridView, and my choices were down to using TableAdapters/DataTables and business objects. While writing your own classes seems (to me, at least) to be the nicer way of structuring your program–if done right, it forces you to put all of the rules for handling data in its own tier–it gets a bit ugly when you have to hook up your custom classes to some of .NET’s built-in controls. Specifically, it starts getting to be a hassle once you realize that all the automagic goodness of GridView is a product of using the DataTable, and that sorting a list of objects on one member requires writing a whole new custom class per member. Maybe it’s the two and a half years of Python programming talking, but it seemed like there had to be a better way.