For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

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

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip