Skip to main content Skip to footer

How to Persist Sorting in Spread .NET for WinForms

Background (Needs Cleaned Up Before Posting):

When the datasheet is reloaded In Spread .NET for WinForms with sort and filter enabled through a single context menu (AutoFilterMode = EnhancedContextMenu), even though the sort icon persists, the new dataset loaded does not get sorted.

This article shows how to persist sort status in Spread .NET for WinForms even after the data source is reloaded.

Steps to Complete:

1. Handle FpSpread’s Sorted event and inside, store the sort information for the sorted column through SortedEventArgs SortInfo.

2. After the data set reloads, traverse through the dictionary and , using the SortRows method, resort the spreadsheet for the new data source.

Ruchir Agarwal