Click here to Skip to main content
16,018,158 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using gridView and have column like below:
<asp:BoundField HeaderText="Column1" DataField="Field1" />
<asp:BoundField HeaderText="Column2" DataField="Field2" />
<asp:BoundField HeaderText="Column3" DataField="Field3" />
.
.
Now i want to chage order of column at run time.
Can any one help how can i do this.
Posted

1 solution

 
Share this answer
 
Comments
jaideepsinh 27-Dec-14 2:48am    
What change i make in that jquery?
DamithSL 27-Dec-14 3:07am    
you can change the column order in your code behind file. for example if you using c# and column re ordering done on button click event, in your button click event you can do as below
gridview1.Columns["Column3"].SetOrdinal(0);
jaideepsinh 27-Dec-14 4:57am    
It generate error i can't fount DisplayIndex metod or property in gridview.
DamithSL 27-Dec-14 5:06am    
have you check the accepted answer in the given link?
How to Change order of columns in gridview[^]
use
gridview1.Columns["Column3"].SetOrdinal(0);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900