Edit: As your datagridview is bound with a linq query, it will not be sorted.
So please go through this link which explains how to create a sortable binding list and to then feed it as datasource to datagridview. I've used this very successfully with the Data Grid View.
You do this by using the Formatted Value property of the Data Grid View Cell Validating Event Args parameter.
This property returns the new value entered in the cell.
I am now able to sort by clicking the column headers.Note that some questions are duplicated in multiple sections based upon the section relevancy.The question and answers with code samples/snippets are contained in this documents only appendix to make for a one-stop shop of code. Something there is causing the cell validating event to fire. [Edit] The validating event is firing because focus is being moved from the DGV to the button.To perform any custom validation on the cell or row being edited, you can use the Cell Validating and Row Validation events, respectively.