This project is read-only.

Sortable Collections

Feb 2, 2011 at 5:49 PM

I would love to be able to bind an object collection to a winforms datagridview and be able to sort it with the default grid functionality.

Is there any chance that this could be added to the DAL?  I believe the interface that needs to be implemented is IBindingListView.

Does any one know a way to achieve datagridview sorting with a collection in the current DAL, or should I implement IBindingListView on a case-by-case basis?


Thanks in advance,



Feb 2, 2011 at 9:31 PM

The NHDAL does not implement this interface but I am not sure that it needs to do so. I just loaded a collection and bound it to the datasource of a DataGridView. All data was showing. I think changed some data and which did update the collection. I called the collection's Persist method and the database was updated. If this is what you need to do, it appears this already works. Please let me know your feedback.

Feb 2, 2011 at 9:48 PM

I do this already as well...

What I am really looking for is to be able to click a column header and have the grid sort.  As it would if you simply bound it to a dataview, or datatable.

It could be that I'm just missing an easy way to accomplish this feat without implementing the interface.