Related Entity Two way Binding

Posts   
 
    
deathwish
User
Posts: 56
Joined: 07-Nov-2006
# Posted on: 02-Mar-2007 14:46:53   

Hi,

Sorry i know this has been asked a few times, couldn't find anything that really helped. I am using LLBLGen v2, SQL 2005, VS 2005.

I have a detailsview bound to a LLBLGenProDatasource:


<llblgenpro:llblgenprodatasource id="requestCollectionDataSource" runat="server" datacontainertype="EntityCollection"
    entitycollectiontypename="preLink.Data.CollectionClasses.RequestCollection, preLink.Data">
</llblgenpro:llblgenprodatasource>

The Request contains a GuarantorId.

In the detailsview there is a field with a textbox that has:


text='<%# Bind("GuarantorFirstName")%>'

In the RequestEntity, there is a custom property:


public string GuarantorFirstName
{
    get
    {
        return this.Guarantor.FirstName;
    }
    set
    {
        this.Guarantor.FirstName = value;
    }
}

Here is a screenshot of debugging the custom property. .The Guarantor.Firstname does not get set to the value. It goes into the SetNewFieldValue() method on the GuarantorBaseEntity.FirstName but as soon as it returns to this.Guarantor.Firstname, it's value is ''.

Is there anyway of doing this? i have 5 detailsviews on a webpage all bound to the same datasource. It is a rather large data capture page where data must be inserted into 4 different tables, all related to the RequestEntity.

I am assuming someone is going to to say use different datasources and set the FK on the other datasources. Well then how, when i click insert on the main detailsview, do u get all the other related detailsviews to insert their data related to the RequestEntity.

I would like to do this declaritively, or very small amount of code, and not writing large amounts of code.

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Mar-2007 15:03:51   

I am assuming someone is going to to say use different datasources and set the FK on the other datasources.

That's me simple_smile , you can use SelectParameters to link between related dataSources.

Well then how, when i click insert on the main detailsview, do u get all the other related detailsviews to insert their data related to the RequestEntity.

By manually saving the hierarchy using the Unit Of Work object. (Setting LivePersistence = false)

I would like to do this declaritively, or very small amount of code, and not writing large amounts of code.

It will require few lines of code.