LLBLGenProDataSource2 related Entities

Posts   
 
    
Posts: 72
Joined: 11-Aug-2006
# Posted on: 25-Aug-2009 06:47:24   

Hi THere

LLBLGenPro v 2.6 , Broswer IE 8, SQL SErver 2005 Express, Telerik RadGrid.

Added the code below to add prefetch to retrieve related entities..

I want to bind a formview to the "master" record ( Contribution record ) - easy enough - and bind a grid to the related smile etails" records ( ContributionAllocation ) . What is the simplest way to do this?

    protected void ContributionDS_PerformSelect(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs2 e)
    {

PrefetchPath2 prefetch = new PrefetchPath2((int)EntityType.PmtContributionEntity); prefetch.Add(PmtContributionEntity.PrefetchPathPmtContributionAllocation); ContributionDS.PrefetchPathToUse = prefetch;

using (DataAccessAdapter adapter = new DataAccessAdapter()) { adapter.FetchEntityCollection(e.ContainedCollection, e.Filter, 0, e.Sorter, prefetch); } }

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 25-Aug-2009 10:08:56   

Are you using Paging in the FormView? If so then whenever a page is selected (a contributionEntity from the bound dataSource), you should pick its ContributionAllocation collection and bind it to the detail Grid.

Also you can use 2 LLBLGen Pro DataSources, and then use a SelectParameter in the detail dataSource to be filtered according to the master data.

Many Good examples are published in the the ASP.NET 2.0 databinding example. (not the CRUD one). http://www.llblgen.com/pages/secure/ListDownloads.aspx?ProductVersion=6

Posts: 72
Joined: 11-Aug-2006
# Posted on: 25-Aug-2009 23:29:06   

Walaa wrote:

Are you using Paging in the FormView? If so then whenever a page is selected (a contributionEntity from the bound dataSource), you should pick its ContributionAllocation collection and bind it to the detail Grid.

Also you can use 2 LLBLGen Pro DataSources, and then use a SelectParameter in the detail dataSource to be filtered according to the master data.

Many Good examples are published in the the ASP.NET 2.0 databinding example. (not the CRUD one). http://www.llblgen.com/pages/secure/ListDownloads.aspx?ProductVersion=6

Thanks - I would like to use the first option - but we don't use paging ( it's only a single record - or adding a new record ) . what is the best event to bind the data?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 26-Aug-2009 11:25:55   

what is the best event to bind the data?

FormView_DataBound.