I tried to sort a data table with following two ways
table.DefaultView.Sort = "Town ASC, Cutomer ASC"
table.Select("", "Town ASC, Cutomer ASC")
But none of them wasn’t worked. It always displays data in original order. Do you have any idea to solve the problem.
After setting the sort expression on the DefaultView (
table.DefaultView.Sort = "Town ASC, Cutomer ASC") you should loop over the table using the DefaultView not the DataTable instance itselfUsing the Select method of the DataTable instead, produces an array of DataRow. This array is sorted as from your request, not the DataTable