Binding GridDropdown colum

Posts   
 
    
weezer
User
Posts: 42
Joined: 24-Apr-2012
# Posted on: 05-Jul-2012 08:53:18   

Hi I am currently try to bind 2 column using GridDropdown colum

here is my current code:


<telerik:GridDropDownColumn UniqueName="StudentEnrolmentID" DataSourceID="odsStudentName" DataField="StudentEnrolmentID"
                                            ListTextField="Surname" ListValueField="EnrolmentID"  HeaderText="Participant"/>


<asp:ObjectDataSource ID="odsStudentName" runat="server" 
                    SelectMethod="GeStudentEnrolmentEntityCollection" 
                    TypeName="Det.PPS.Presentation.Shell.Services.StudentEnrolmentService">
                    </asp:ObjectDataSource>

currently i am only able to bind surname, i would like to bind firstname as well or combine first name and surname. Please advise how i can achieve this?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Jul-2012 18:40:01   

Either use a dynamicList to concatenate firstName and LastName into fullName. Or just add a property for the FullName in a partial class file of the generated entity class. Then bind to this property.

weezer
User
Posts: 42
Joined: 24-Apr-2012
# Posted on: 06-Jul-2012 03:17:26   

public EntityCollection<StudentEnrolmentEntity> GeStudentEnrolmentEntityCollection() { using (DataAccessAdapter aAdaptor = new DataAccessAdapter()) { EntityCollection<StudentEnrolmentEntity> studentEnrolmentCollection = new EntityCollection<StudentEnrolmentEntity>(); RelationPredicateBucket filter = new RelationPredicateBucket(); filter.PredicateExpression.Add(StudentEnrolmentFields.DepartureDate == DBNull.Value); aAdaptor.FetchEntityCollection(studentEnrolmentCollection, filter); return studentEnrolmentCollection; }

    }

This is my first project with LLBLgen, Would you kindly help me how i can achieve my adding to add property for the FullName. Thank you

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Jul-2012 04:48:49   

In a partial class of your StudentEnrolmentEntity:

partial class StudentEnrolmentEntity
{
     public string FullName
     {
          get 
          {
               return string.Format("{0} {1}", this.FirstName, this.SurName);
          }
     }
}
David Elizondo | LLBLGen Support Team
weezer
User
Posts: 42
Joined: 24-Apr-2012
# Posted on: 06-Jul-2012 07:17:44   

Thank you. I also trying creating view which also fix the problem. Thank you