LLBLGenProDataSource2 Problem

Posts   
 
    
hameedAEM1
User
Posts: 17
Joined: 14-Sep-2006
# Posted on: 03-Oct-2006 12:38:59   

Hi,

I am using Adapter/VS2005/C#/ASP.Net.

I have dragged the LLBLGenProDataSource2 onto my webform and binded it to my parent gridview (say touroperators). I then have a child gridview, brochures.

I prefetch all the data needed to display touroperators in the parent gridview and when a touroperator is selected I display the brochures for that touroperator.

Now the problem I am having is that gridview2 (child) i load when a gridview1_selectedindexchange event is fired. I get the datakey and and using this load all data associated with this touroperator.

So hence I can get t.Brochure to get the collection of brochures. All good so far.

Now when I try and associate this with the LLBLGenProDataSource2_2 datasource by doing this:

LLBLGenProDataSource2_2 = t.Brochure;

I get the following error:


Cannot implicitly convert type 'AEM.CMS.DAL.HelperClasses.EntityCollection<AEM.CMS.DAL.EntityClasses.BrochureEntity>' to 'SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSource2'

Now thr problem is that t.Brochure returns an EntityCollection that uses generics but it appears that LLBLGENProDataSource2 does not support this.

How/what is the best way to achieve what I am trying to do.

Hameed.

phoenix
User
Posts: 11
Joined: 13-Mar-2006
# Posted on: 03-Oct-2006 13:24:05   

Hi,

I'm also having a simular problem to yourself, i'm using an infragistics WebGrid.

When i bind the CollectionClass to the DataSource i get an error due to inconsistant datatypes.

But if i bind the Collection Class Directly to the UltraWebGrid the results from the database query do bind without errors.

Thanks for your help

hameedAEM1
User
Posts: 17
Joined: 14-Sep-2006
# Posted on: 03-Oct-2006 15:12:25   

Hi Phonix,

That is correct, I can bind the collection directly to the bindginsource/gridview but not through the llblgen datasource object.

Should I not bind the collection to the datasource object so I can use the LIvePersistence feature of the datasource and or the events that come with the datasource??

Hameed.

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 03-Oct-2006 16:01:09   

Hi,

indeed you can't do yourDataSource = yourCollection cause they're not of the same type.

you can do yourDataSource.EntityCollection = yourCollection

However, the datasource is meant to handle the fetch by itself, so you should look for using yourDataSource.select() instead, by providing your filters, prefetches paging params etc... directly to the datasource object.

Cheers

hameedAEM1
User
Posts: 17
Joined: 14-Sep-2006
# Posted on: 03-Oct-2006 17:05:43   

Hi Jessynoo,

However, the datasource is meant to handle the fetch by itself, so you should look for using yourDataSource.select() instead, by providing your filters, prefetches paging params etc... directly to the datasource object.

Does this mean that I would need to set the LivePersistence to false and handle the persistence of the data myself?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Oct-2006 08:43:55   

What I understand is that you want to load the child Grid when you select a row from the parent Grid.

Then all you need to do is to define a <SelectParameter> in the LLBLGenProDataSource2_2 declaration which may look as follows:

<cc1:LLBLGenProDataSource2 ID="LLBLGenProDataSource2_2" runat="server"
    LivePersistence="True" ....... >
    <SelectParameters>
        <asp:ControlParameter Name="BrochurId" ControlID="Grid1"  PropertyName="SelectedValue" Type="String" />
    </SelectParameters>
</cc1:LLBLGenProDataSource2>