views:

114

answers:

1

I'm using c#2.0 and WinForms.

I have a datagridview control, unbound, loading small amounts of data which include a "Status" relating to a customer.

Now statuses are set up by the user and assigned a sequence number. I would like to display the name of the status in a column on the grid (straight forward enough) but have the customer data in my gird, ordered by the Status's sequence number, not it's name (alphabetically) when the user clicks the "Status" column heading.

Is this possible? How?

+1  A: 

You'll want to have a custom sort on your DataGridView. See this article on MSDN.

The sample you'll want to look at is Custom Sorting Using the IComparer Interface. Your RowComparer will check each DataGridViewRow sequence number cell.

Jay Riggs