Click here to Skip to main content
15,909,445 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!!!!


I have a datagridview with data from database binding objects list.
when I insert object list to datagridview's datasource, I can't click datagridview's header to sort. So, I want to make sorting datagridview's header.
How could I do? Please help me about that.


Warmly regards,
nwe nwe
Posted

Search my article http://www.codeproject.com/KB/grid/DataGridEnumArticle.aspx for the word sort and you will find the code
 
Share this answer
 
Try this

C#
for (int i = 0; i < datagridview1.Columns.Count; i++)
{
   datagridview1.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic;
}
 
Share this answer
 
You can try this,
http://msdn.microsoft.com/en-us/library/ms171608.aspx#Y1710[^]

Hope this helps you out.
 
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