If i put the dataview as a datasource of a datagrid the sorting works fine.
If i load the records one by one from the dataview the position of these records is the same as before the sort.
How can i avoid this
If i put the dataview as a datasource of a datagrid the sorting works fine.
If i load the records one by one from the dataview the position of these records is the same as before the sort.
How can i avoid this
DataView sort
CWORRELLSTER
I'm sure you;'ve already figures this out, but I could not get my sort to work at all.
I just found the answer, and decided to post it so all others could find a solution to the dataview sort not sorting when your not binding to any datagrid. Cause I searched for hours trying to figure this out.
How to access the row of the sorted dataview.
dv.table is the unsorted
while
dv(i).Row gives you the row of the sorted set.
dv..Table.Rows(i).Item("someword") returns from the none sorted set.
Dim i As Int32 Dim dv As DataView Try 'use dataview to sort rank on resultsdv =
New DataView(mdtRankedResults.DefaultView.Table)dv.Sort =
"Rank DESC"For i = 0 To dv.Table.Rows.Count - 1
If mblnResults = True And dv(i).Row.Item("section") = 1 ThenResultsEventsShow(dv(i).Row)
End IfIf mblnResults = True And dv(i).Row.Item("section") = 2 Then
ResultsNewsShow(dv(i).Row)
End IfNext
SarahH
Hi
I think you can use DataView. But, you should fetch data through dataview.
If you are not using dataview as datasource your don't need to worry about dataview.
In my Idea DataView has to work if you are fetching data through dataview not directly from DataTable
R.K.S.
Not sure, but:
Don't access the dataview directly, if you want to access the rows as the datagrid sees them.
Go through the currencymanager' List object
Michael_Guinto
oriticol
Sounds like you're trying to actually sort the database...
A Dataview is simply that - a "view" of the same data.
Dataviews allow you to present a set of data to the user in various ways: sorted or filtered. You can assign a dataview to a datagrid, then make the column headers perform different sorts when you click them. You can also set the filter properties to only show certain records.
The dataview shouldn't change unless it loses scope or you change the properties...