views:

19

answers:

0

I have swapped the columns of a gridview based on some condition using following code, but after postback there are no controls in the columns.

DataControlFieldCollection dc = gvLanguage.Columns.CloneFields();
gvLanguage.Columns.Clear();
gvLanguage.Columns.Add(dc[1]);
gvLanguage.Columns.Add(dc[0]);

Can these controls not be reinstated on postback ? Or how can I achieve this swapping or I need to add the columns altogether dynamically in code ?