I have searched and searched to see if someone else ran into this and did not find anything so here we go... it's probably a simple fix that I am just missing.
FYI: I am using asp.net 3.5 and sql express 2005.
The paging seems to be okay but the sorting is out of whack. Each page sorts correctly the records that it shows, but then page 1 has items that should be on page 2 and vice versa.
I am sorting by ActionDate, Descending and page 1 may have the following dates:
10/28/2008 @ 12:05 PM
10/28/2008 @ 11:23 AM
10/28/2008 @ 11:16 AM
10/28/2008 @ 10:40 AM
10/28/2008 @ 10:03 AM
And page 2 will have these:
10/28/2008 @ 11:44 AM
10/28/2008 @ 11:18 AM
10/28/2008 @ 10:18 AM
10/28/2008 @ 9:46 AM
10/28/2008 @ 9:38 AM
Notice that the items on each page are sorted correctly but the entire collection is not.
I am using an LLBLGenPRoDatasource to bind data to a GridView in asp.net. Here is the markup:
<asp:GridView ID="GridView1" runat="server" DataSourceID="dsActivity" AllowPaging="true" AutoGenerateColumns="false" PageSize="5" RowStyle-Font-Size="10pt" AlternatingRowStyle-Font-Size="10pt" AlternatingRowStyle-BackColor="AliceBlue" Width="85%" BorderStyle="None" BorderWidth="0" RowStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
<Columns>
<asp:BoundField DataField="ActionDate" HeaderText="Date" DataFormatString="{0:d} @ {0:t}" SortExpression="ActionDate" />
<asp:BoundField DataField="Action" HeaderText="Activity" ItemStyle-Width="65%" SortExpression="Action" />
</Columns>
</asp:GridView>
<llblgenpro:LLBLGenProDataSource runat="server" ID="dsActivity" EnablePaging="true" SortingMode="ServerSide" DataContainerType="EntityCollection"
EntityCollectionTypeName="HappyMondaysDAL.CollectionClasses.ActivityLogCollection, HappyMondaysDAL" LivePersistence="true">
</llblgenpro:LLBLGenProDataSource>
And here is what I call during Page_Load:
//set up the activity datasource...
IPredicateExpression filter = new PredicateExpression();
filter.Add(ActivityLogFields.ChurchId == GetID());
filter.Add(ActivityLogFields.ActionDate >= DateTime.Now.AddDays(-30));
dsActivity.SorterToUse = new SortExpression(new SortClause
(ActivityLogFields.ActionDate, SortOperator.Descending));
dsActivity.FilterToUse = filter;
Any help is appreciated.