views:

316

answers:

1

I have a DataGridView bound to a DataTable (it was bound to a List(of T) but the DataGridView is much more performant).

I add an extra DataGridViewLinkColumn to the DataGridView (the value of this column is set to equal the value of one of the bound columns, I just need it to show as a link).

The problem is when I sort the DataGridView by clicking on a header the values in the unbound column clears.

Do I need to loop through the rows each time to reset the values, or is there a better way of getting a DataGridViewLinkColumn as one of my bound columns?

+2  A: 

Create a new class 'TRow' with all the fields you need from T, plus the link, and bind to a DataTable of TRow objects. The extra column will now be a bound column instead of unbound and your sorting should work.

Mark Byers