v2.6 October 2009, Adapter, Win 7, Sql Server 2008
I am creating a master-details page with a nested ASPxGridView. It all works correctly with the master EntityCollection I create, but I am stuck on how to define that the details grid should use a Prefetch Path of that EntityCollection. Here is the code I am using:
[code]
<llblgenpro:LLBLGenProDataSource2 ID="clients" runat="server" AdapterTypeName="MyCompany.BusinessObjects.Adapter.DatabaseSpecific.DataAccessAdapter, MyCompany.BusinessObjects.Adapter"
DataContainerType="EntityCollection" EntityFactoryTypeName="MyCompany.BusinessObjects.Adapter.FactoryClasses.ClientEntityFactory, MyCompany.BusinessObjects.Adapter"
LivePersistence="false" OnPerformSelect="Clients_PerformSelect">
</llblgenpro:LLBLGenProDataSource2>
<dx:ASPxGridView ID="ASPxGridView1" runat="server" DataSourceID="clients" KeyFieldName="IDClient">
<SettingsDetail ShowDetailRow="True"></SettingsDetail>
<Templates>
<DetailRow>
<dx:ASPxGridView ID="ASPxGridView2" runat="server" DataSourceID="clients" SettingsDetail-IsDetailGrid="True">
</dx:ASPxGridView>
</DetailRow>
</Templates>
</dx:ASPxGridView>
[code]
The code accessed via the Clients_PerformSelect event handler to create the EntityCollection is:
public LLBLGenProDataSource2 LoadDataSource(LLBLGenProDataSource2 clients)
{
var client = (from a in metaData.Client
where a.ClientName.StartsWith("c")
select a).IncludeFields(a => a.ClientName)
.WithPath(b=>b.Prefetch(c=>c.DomainName));
clients.EntityCollection =
((ILLBLGenProQuery)client).Execute<EntityCollection<ClientEntity>>();
return clients;
}
This gives a master grid with details grid being exactly the same, just as expected from the above code.
So I want the details ASPxGridView to use the clients.DomainName prefetch path instead of clients but I can't work out how to do this, even after reading the examples