how to set the datagridview columns to allow user to click to sort

how to set the datagridview columns to allow user to click to sort

Post by AboutJA » Sat, 08 Sep 2007 03:26:26

Hi,

I have a datagridview with 3 columns. the grid selectionmode is set
to

this.grid.SelectionMode =
System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;


I even set the columns sort property to

System.Windows.Forms.DataGridViewColumnSortMode.Automatic


When the form is loaded and any of the 3 columns are clicked, nothing
happens. The data does not reordered in any directions.

Any advice is appreciated.

Thanks,

 
 
 

how to set the datagridview columns to allow user to click to sort

Post by Jack Jacks » Sat, 08 Sep 2007 03:41:04

What is the DataGridView bound to, or is it unbound?

 
 
 

how to set the datagridview columns to allow user to click to sort

Post by AboutJA » Sat, 08 Sep 2007 05:22:16

The datagridview is bounded to an object with a collection.
 
 
 

how to set the datagridview columns to allow user to click to sort

Post by Tim Van Wa » Sun, 09 Sep 2007 22:48:43


You'll have to be more specific about the collection that you're using..
eg: by default a BindingList<T> does not support sorting.

A websearch will return you many valueable resources with
implementations of collections that do allow sorting. Even i was
able to write a SortableBindingList<T>
( http://www.yqcomputer.com/ )

--
Kind regards,
Tim Van Wassenhove <url: http://www.yqcomputer.com/ ;