For smart Primates & ROBOTS (oh and ALIENS ).

Tuesday, July 08, 2014

Sort Datagridview column by button click c#

Sort Datagridview column by button click c#

If you have added the random records in your Datagridview C# winform and want to show records by any column on button click then use this:

-------------------------------------------------------------------------------------
dataGridView1.Sort(dataGridView1.Columns[1], ListSortDirection.Ascending);
-------------------------------------------------------------------------------------
OR
-------------------------------------------------------------------------------------
dataGridView1.Sort(dataGridView1.Columns["mark"], ListSortDirection.Ascending);
-------------------------------------------------------------------------------------

"mark" is the cell name in the datagridview.


Share:

0 comments:

Post a Comment

Featured Post

Core Web Vitals Assessment showing LCP 10.6s while google pagespeed report showing LCP 3.5s why?

Core Web Vitals Assessment showing LCP 10.6s while google pagespeed report showing LCP 3.5s why? So, you can face this situation while...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive