Skip to main content

Sorting a grid

Comments

1 comment

  • Dapfor Team

    Hi,

    Indexes in the ThreadSafeBindedList or in simple BindingList don't correspond to ones in the grid. There are many reasons for that: rows in the grid can be filtered/grouped/sorted etc. Moreover multiple grids with different sorting can be bound to the same list.

    The better solution is to sort by the 'time' column:

     

    grid.Header[0]["time"].SortDirection = SortDirection.Ascending;

     

    if you want to prevent the user from sort changing, set Column.Sortable property for each column to false.

    For performance reasons it will be better to add data to the end of the collection.

    Best regards,
    Dapfor

    0

Please sign in to leave a comment.

Powered by Zendesk