Datagridview column sorting when clicking on the column header

我们两清 提交于 2019-12-11 07:03:30

问题


I have a datagridview with two columns name and price.

If I click on the column header, the corresponding column will be sorted in alphabetical order. Do I need to add any event handler for sorting the datagrid view column? Or is there any property to set for sorting datagrid view column? I am working on a Windows application using C#.

Would anyone please help on this?


回答1:


If you could use javascrip/jQuery I would suggest you to use the JQuery plugin Datatabe.

With that you can get the colum sorting, colum reordering, filtering and search all together.

EDIT:

If not javascript, then you can use the following guide: DataGrid sort



来源:https://stackoverflow.com/questions/7140800/datagridview-column-sorting-when-clicking-on-the-column-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!