Sorting on BusinessListBase and WebPage

Sorting on BusinessListBase and WebPage

Old forum URL: forums.lhotka.net/forums/t/4622.aspx


ToddH posted on Saturday, April 05, 2008

I've got a parent class (User) with a BusinessListBase child collection (Roles). On my web page, I allow the user to modify the User data through asp:TextBoxes and modify the Roles list (adding/deleting Roles) through an asp:GridView and an "add role" hyperlink. When a user adds a new role, the gridview refreshes. However, I am not actually saving the data and the Roles until the user clicks the "Save" button. How to I force the gridview to automatically sort the Roles list each time another Role is added? On the CslaDataSource, the Roles class, or the GridView?

(After the list is saved, I sort it from SQL on the next load. However, I'd like it to be sorted pre-saved.)

Thanks in advance,

Todd

JoeFallon1 replied on Monday, April 07, 2008

In 3.5 you can use LINQ for this.

In older versions use the SortedBindingList which comes with CSLA.

Or download ObjectListView if you need to sort on more than 1 column. It is part of CSLA Contrib.

Joe

 

Copyright (c) Marimer LLC