Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Server side sorting with an ObjectDataSource
posted

When clicking on a header to sort a column, it does a postback, but it doesn't include the sort criteria on the ObjectDataSoruce.  When the grid refreshes, it does a client-side sort of only the visible rows.  If I scroll down so it does a LoadOnDemand, this time the ObjectDataSource has a sort criteria and the new rows are correctly sorted, but the whole grid is not sorted correctly because of the first page. 

 Any ideas on how to make the first sort pass the sort criteria to the ObjectDataSource?  The ObjectDataSource is returning an array of objects.

Thanks,
Doug

  • 28464
    posted

    Hello Doug,

    I think there are a couple of approaches here

    1) Use the grid built-in functionality - use sorted column by default, with something similar to:

    MyGrid.Bands(0).SortedColumns.Clear
    MyGrid.Bands(0).SortedColumns.Add(MyGrid.Columns.FromKey("MyPrimaryName"), True)

    More info, details and additional code samples can be found in this forum thread:

    http://forums.infragistics.com/forums/p/9193/35890.aspx#35890

    2) Sort the ObjectDataSource (or at least the first page) prior to binding the grid.