Use
DataView
to sort your data.
DataView dv = new DataView();
dv = dt.DefaultView;
dv.Sort = "SortExpression";
Here, SortExpression is your sort column(s).
You may also provide sort direction with the sort expression.
Something like this:
dv.Sort = "EmpCode" + " ASC";
dv.Sort = "EmpCode" + " DESC";
Then bind the
GridView
to the
DataView
Hope this helps!