my requirement is i have to sort datatable. datatable named dt_Path and column named PAFPOS contains data like for representation PAFPOS 10 4 2 6 5 7 1 3 9 8 15 12 11 13 14 19 16 17 20 18 . . . requirement says that number 1 to 10, 11 to 20 should sorted in descending order this end point numbers i will be passing in Path1 and Path2 Variable as this numbers i get from dt_Line table. example : Path1 = 1 and Path2 = 10 required result PAFPOS 10 9 8 7 6 5 4 3 2 1 20 19 18 17 16 15 14 13 12 11 . . . what i have done is for (int i = 0; i < dt_Line.Rows.Count; i++) { Path1 = Convert.ToInt64(dt_Line.Rows[i]["PA_KEY_1"]); Path2 = Convert.ToInt64(dt_Line.Rows[i]["PA_KEY_2"]); DataView view = new DataView(dt_Path); view.RowFilter = "PAFPOS >= " + Convert.ToInt64(Path1) + " and PAFPOS <= " + Convert.ToInt64(Path2) + ""; view.Sort = "PAFPOS DESC"; } now i get Sorted values in view but i dont know how to update that sorted values back to datatable dt_Path. Condition is After sorting; number of records in Sorted dt_Path should be equal to number of records in dt_Path before Sorting. Also I wanna ask. guys is it possible to update dataview back to datatable. Regards.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)