Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a gridview in c#, i want add column that show the order
this form
1 A
2 B
3 C
4 D
5 E
Posted
Comments
thatraja 28-Nov-10 1:24am    
elaborate your question more....so that you can get solution quickly

You can do just as you said: Add a column and put the row number + 1 in it. Also take a look at the RowsHeadersVisible and HeaderCell properties.

C#
dataGridView.RowHeadersVisible = true;
dataGridView.Rows[i].HeaderCell.Value = (i + 1).ToString()
 
Share this answer
 
IF you are looking for information on how to sort columns, then see here[^].
You can also check out msdn.
 
Share this answer
 

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