May 25, 2006, 04:37 PM
win form 2003 Datagrid column sort on load
I need to sort a specific column of a datagrid in descending order on the form load event of a windows form
doing the sort in the sql query is not an option as my company is using visual developer and i don't have access to the query.
Does any one have any suggestion?
May 25, 2006, 05:06 PM
found some code that will work
Dim mydv As DataView = New DataView
Dim columnname As String = Datagrid.TableStyles(0).GridColumnStyles(specificC olumnToSort).MappingName
Dim mydt As DataTable = New DataTable
mydt = Datagrid.DataSource
mydv = mydt.DefaultView
mydv.Sort = columnname + " DESC"