How can I change gridview templatecolumn order dynamically?
Iterate through all columns of the GridView object and Store them in a collection.
List<DataControlField> columns = new List<DataControlField>(); foreach (DataControlField column in gv.Columns) { columns.Add(column); }
Rearrange the column-objects as you want in the collection.
//Rearrange columns' collection..
Clear all columns of the GridView object and add columns from the collection to GridView object.
gv.Columns.Clear(); foreach (DataControlField column in columns) { gv.Columns.Add(column); }
1.4m articles
1.4m replys
5 comments
57.0k users