Unfortunately, there's nothing built-in to facilitate custom sorting logic in the DataView
; that's been one of my chief complaints, and one of the reasons that we decided to roll our own data access layer at my old job.
While I don't know how feasible this would be for you to do, to really achieve this you'd need to add another column to your table as an int, then sort the rows in an array based upon your own comparison logic, then store the index in the array in your int
column. Then, rather than ordering by the string
column order by the int
column.
I do recognize, however, that this doesn't satisfy things like automatic sorting that gets done by a GridView
and it doesn't account for changes to the data that take place after you calculate the sorting positions. Unfortunately, I don't think there's anything that can really help with this.
If you're looking to sort this visually, check and see if your visual control supports a custom sorting mechanism. That's about all I can suggest.