How can I change the display order of columns from a DataTable?
For example, dataTable "dt" contains two columns "a" and "b". I bind it to the GridView as follows:
gridView.DataSource = dt; gridView.DataBind();
But I would like the GridView to first display "b" (on the left).
The important point: I use this to export to Excel, and there is no actual output to the screen using:
HtmlTextWriter htw = new HtmlTextWriter(sw); gridView.RenderControl(htw);
Thanks!
source share