Reputation: 103
I want to sort all the data of DataTable
, I want sort on Column2
as alphabetically.
DataView dv = new DataView(DT);
dv.Sort = "Column2 ASC";
DT.DefaultView.Sort = "Column2 ASC";
Upvotes: 1
Views: 5655
Reputation: 1478
DataView dv = yourDataTable.DefaultView;
dv.Sort = "Column2";
yourDataTable = dv.ToTable();
You don't need to add ASC, it's a default, unless you want DESC :) This code worked for me :)
Upvotes: 1