I understand your point of view.
Let me say that in SQL Query Analizer if I execute a SQL statement
“SELECT * FROM Table ORDER BY Field DESC” it doesn’t show the
result ordered also BY ID (where ID is the Table’s PRIMARY KEY) DESC.
Furthermore I assign the datasource to gridcontrol as shown below
GridControl.DataSource = myDataview.
To be able to modify data in datasource (we use a normal edit form
to modify data stored in a DatarowView item collection) I assign
myDataview.Sort=GridControl.SortedColumns.ToString and so
the data in the two collections (GridControl.Rows collection
and myDataview.item collection) aren’t in the same order.
This because myDataview doesn’t invert the whole grid,
but only apply specified sort. So when I select a row in GridControl,
and press a button to open the form to modify SelectedRows data,
the form is loaded with wrong row item (due to different order).
I try your workaround, but I wasn’t able to let it work,
because when I first click on Column to have it orderd ASC,I do nothing,
then when I sort again (from ASC to DESC) by code I add ID ASC.
This is working but is also changing standard behaviour of gridcontrol,
where there is a cicle ASC—>DESC–>nothing—>ASC—>DESC–>nothing,
while doing in this way we obtain ASC—>DESC,ASC—>ASC—>DESC,ASC
with no way to remove sort.
Above all I have to say that we would like to use it to change a lot of datatable,
not only one table, and ‘natural’ order isn’t always the primary key of the table,
but change depending from the datatable, and so is not so simple to found which
columns determines which is the ‘natural’ order, and if SortedColums collections
already contains it and so on…
Can you send me a little example that will help in my testing scenario?
Thanks in advance
Imported from legacy forums. Posted by Gian Luigi (had 457 views)