Dropdown Bind multiple filed from multiple table

Posts   
 
    
Posts: 97
Joined: 29-Apr-2009
# Posted on: 11-Aug-2009 06:22:47   

Hello All,

i am using LLBLgen 2.6 & self servicing with MS SQL 2005

i have one table called: Coach

please see this image

www.freeimagehosting.net/uploads/3a788a2206.png

I have second table called: User

www.freeimagehosting.net/uploads/f816739982.png

now i have one drop down list and binding with following code



UserCollection claUser = new UserCollection();
            IPredicate PreuserRole = (UserFields.RoleTypeId == 3 & UserFields.IsActive ==1);
            claUser.GetMulti(PreuserRole);

            ddCoach.DataSource = claUser ;
            ddCoach.DataTextField = "Username";
            ddCoach.DataValueField = "UserID";
            ddCoach.DataBind();


now here i want to bind firstname & lastname in DataTextField & in DataValueField i want UserID

how can i do in LLBL?

Attachments
Filename File size Added on Approval
Coach.png 3,753 11-Aug-2009 06:22.58 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 11-Aug-2009 07:02:44   

Do this:

  1. Use prefetchPath to avoid lazy loading on your combo. Fetch all at once (the root entity and the related entity).

  2. Use a Custom Property that return the contatenation of the two fields. An example: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14782&StartAtMessage=0&#82346

  3. Map that custom property on your combo wink

David Elizondo | LLBLGen Support Team
Posts: 97
Joined: 29-Apr-2009
# Posted on: 11-Aug-2009 07:41:03   

daelmo wrote:

Do this:

  1. Use prefetchPath to avoid lazy loading on your combo. Fetch all at once (the root entity and the related entity).

  2. Use a Custom Property that return the contatenation of the two fields. An example: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14782&StartAtMessage=0&#82346

  3. Map that custom property on your combo wink

hi daelmo,

thanks for reply

but i cant get that previous thread link. can your specify more reading that, or any sample code...

thanks again

Posts: 97
Joined: 29-Apr-2009
# Posted on: 11-Aug-2009 08:08:47   

daelmo wrote:

Do this:

  1. Use prefetchPath to avoid lazy loading on your combo. Fetch all at once (the root entity and the related entity).

  2. Use a Custom Property that return the contatenation of the two fields. An example: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14782&StartAtMessage=0&#82346

  3. Map that custom property on your combo wink

hi daelmo,

its done,

thanks, i have modify UserEntity.cs class