Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to change asp gridview column index on code behind in c #

What I have tried:

grdFinancialDetail.Rows[1].Cells[1].TabIndex = 1;
Posted
Updated 16-May-19 6:26am
v2

1 solution

TabIndex will not change the order of columns in your GridView. You can modify the Gridview's Columns collection in your code-behind by removing the column from its current position in the collection and then re-insert it into the new position.

For example, if you wanted to move the second column to be the first column you could do:

C#
var columnToMove = GridView1.Columns[1];
GridView1.Columns.RemoveAt(1);
GridView1.Columns.Insert(0, columnToMove);
 
Share this answer
 
Comments
Noman Suleman 17-May-19 0:48am    
thanks for reply

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