I am using ASP.NET Grid View to display data from tables. I want to arrange the Columns in a specific order selected by user.
Explanation : I would like to swap columns (i.e. index 3 to becomes 5 etc) based on input from the user,is this possible?
I have tried with this code ..but still it gives unexpected result
var boundF0 = (BoundField)GVReport.Columns[0];
var boundF5 = (BoundField)GVReport.Columns[5];
GVReport.Columns.RemoveAt(0);
GVReport.Columns.RemoveAt(5);
GVReport.Columns.Insert(0, boundF5);
GVReport.Columns.Insert(5, boundF0);
any idea what went wrong ?