2.6.10.809 (SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll)
2.6.10.930 (SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll)
2.6.10.917 (SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll)
I am having trouble using the paging on the datasource with events. I use the MVP pattern, so code behind just fires another handler for the presenter to listen to and run real code.
It looks like on moving from one page to another, the PerformGetDbCount and PerformSelect events fire after the Page_Init but before the Page_Load of the user control they are on. This means the attaching of listeners to events happens after the datasource events have fired. This only happens when paging. Other PostBacks run the Page_Load first.
So is this what is meant to happen when paging?
Page_Init -> PerformGetDbCount -> PerformSelect -> Page_Load
If not, how have I screwed it up to work like this?
Here is the datasource:
<llblgenpro:LLBLGenProDataSource2 ID="RegulationListDataSource" runat="server" CacheLocation="Session"
AdapterTypeName="MyCompany.BusinessObjects.Adapter.DatabaseSpecific.DataAccessAdapter, MyCompany.BusinessObjects.Adapter"
DataContainerType="EntityCollection" EntityFactoryTypeName="MyCompany.BusinessObjects.Adapter.FactoryClasses.RegulationTextEntityFactory, MyCompany.BusinessObjects.Adapter"
LivePersistence="false" OnPerformSelect="RegulationListDataSource_PerformSelect"
OnPerformWork="RegulationListDataSource_PerformWork" EnablePaging="true"
OnPerformGetDbCount="RegulationListDataSource_PerformGetDbCount"
AllowDuplicates="False">
</llblgenpro:LLBLGenProDataSource2>
Here is the code behind handler
protected void RegulationListDataSource_PerformGetDbCount(object sender, PerformGetDbCountEventArgs2 e)
{
var handler = RegulationListDataSourcePerformGetDbCount;
if (handler != null) handler(sender, e);
}
Here is the Page_Load method:
protected void Page_Load(object sender, EventArgs e)
{
var presenter = new Presenter(this);
presenter.InitView(IsPostBack);
}
The InitView() method does the listening and sets up variables to use in the Model to create data and get the count. As long as Page_Load runs, it all works fine.
Am I doing something wrong or do I need to set something else up somewhere?
Note that if I move all database accessing to the code-behind, then it works. This isn't our coding style though, so I am keen to sort it out so it will work with the MVP pattern.