Display Business object containing list of another business objects

2 posts, 0 answers
  1. RDot
    RDot avatar
    5 posts
    Member since:
    May 2009

    Posted 06 Oct 2011 Link to this post

    Hi -

     I'm binding my ListView to a class that contains a list which is a list of another class.
     
    For instance,  

    public class Person
    {
      public List<Orders> Orders {get; set;}
    }
     
    public class Orders
    {
       public Guid Id {get; set;}
       public string {get; set;}
    }

    When I bind the ListView to an instance of the person class,  how could i display specific value for one of the orders on the row that displays for the person class?

    Thanks -
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 10 Oct 2011 Link to this post

    Hi Rob,

    Thank you for contacting us.

    I am not sure I understand correctly your scenario, but as far as I can see, you need to bind the RadListView to the Orders collection of your Person class and display either the Id or the string property (which has not been given a name). To do this, you can use the following code:
    Person person = new Person();
    //populate person with data
     
    this.radListView.DataSource = person.Orders;
    this.radListView.DisplayMember = "Id";

    In case I have not understood you correctly, I would kindly ask you to provide me with a more detailed explanation of your scenario and your requirements. You can also send me a sample project which demonstrates them. This will let me investigate your case in detail and provide you with adequate support.

    I hope this is useful. Should you have further questions, do not hesitate to write back.

    Greetings,
    Ivan Todorov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top