|
Hi, I have a DataGridView that I sort using the DataGridView.Sort(myColumn, ListSortDirection.Ascending) method.
How do I tell the DataGridView to STOP sorting?
I'm trying to stop it from automatically sorting (moving) new rows as they are added. I want new rows to stay at the bottom of the DataGridView until the user has finished editing, then I want the DataGridView to sort again.
I'm using VS2005 Beta 2.
Many thanks. Ben S. |
| Ben S Friday, September 23, 2005 8:46 AM |
In VS2005 Beta 2 each column has a SortMode property that can be set to "NotSortable". So I suppose you might be able to set this to "NotSortable" at the appropriate time when you don't want sorting and then back to "Automatic" when you want it sorted again. |
| Matty4242 Friday, September 23, 2005 12:56 PM |
Unfortunately it doesn't work in this case. The SortMode property only controls if the column is sortable by the user clicking on the column header, not the programmer setting the DataGridView.Sort method behind the scenes. Thanks for your time and your suggestion though. Ben S. |
| Ben S Friday, September 23, 2005 1:30 PM |
This is not going to help you but take a look at the following: http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=53586Seems to be indicating a behavior opposite what you are experiencing. How can this be? |
| Matty4242 Friday, September 23, 2005 5:50 PM |
This one sounds similar to yours though... http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=92523Is your grid bound or unbound? |
| Matty4242 Friday, September 23, 2005 5:54 PM |
My grid is data bound. Thanks, Ben S |
| Ben S Monday, September 26, 2005 7:25 AM |
I have the same issue, I tried to override the onlistchanged event of the bindingsource. It doesn't work. It seems the sort has been finshed when onlistchagned was called. Then I tried to add another column to save the sorted rowindex but I don't know where I can get the sorted rowindex for the datatable. Hope anyone can help. |
| Lee2040 Tuesday, June 20, 2006 3:25 PM |
|
| Modem56k Friday, November 03, 2006 7:32 PM |
Hope this will help....  For Each column As DataGridViewColumn In grdApptBook.Columns 'Freeze all Columns column.Frozen = True column.SortMode = DataGridViewColumnSortMode.NotSortable Next |
| Syed Fasih Wednesday, August 15, 2007 10:43 AM |
IF ANY BODY KNOWS HOW TO COMMENT THE SORTING OPTION IN MS ACCESS PLEASE REPLY TO THIS MAIL.
AFTER ADDING SOMETHING IN TABLE IF I REOPEN THE TABLE IT IS IN SORTING THE PRIMARY KEY ID'S VALUES, HOW TO DISABLE THE OPETION?? |
| MURALEE KRISHNAN Monday, October 15, 2007 9:52 AM |