DataGrid and sorting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to produce a simple application that reads XML into a DataSet which is displayed in a DataGrid. My intention was to sort a table by clicking on the column headers and write the sorted rows from the DataSet back to the XML file. The input works fine. In the method that handles the MouseDown event I'm sorting rows by creating a DataView based on the table in the DataSet. The entries in the Dataview appear to be sorted, but when I try to assign the DataView as the datasource for the DataGrid and write the XML file from the DataSet the rows appear in the original order. Somehow the sorted rows do not appear to have found their way to the DataSet. Does anyone have any suggestions?
 
Maybe you could update the dataset first and then write it to xml?

_
Eric

Mike Perreten said:
I'm trying to produce a simple application that reads XML into a DataSet
which is displayed in a DataGrid. My intention was to sort a table by
clicking on the column headers and write the sorted rows from the DataSet
back to the XML file. The input works fine. In the method that handles the
MouseDown event I'm sorting rows by creating a DataView based on the table
in the DataSet. The entries in the Dataview appear to be sorted, but when I
try to assign the DataView as the datasource for the DataGrid and write the
XML file from the DataSet the rows appear in the original order. Somehow the
sorted rows do not appear to have found their way to the DataSet. Does
anyone have any suggestions?
 
Back
Top