How to populate the child grid in Hierarchy

11 posts, 0 answers
  1. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 30 Oct 2010 Link to this post

    Hi,

    Sorry but after reading the documentation and looking at the demo, I did not see how to populate the child grid.  I certainly missed a point somewhere.

    I've read this one : http://www.telerik.com/help/silverlight/gridview-basic-hierarchies.html

    I have 2 seperate collections of data with a relation.  Ok I did set the hierarchy as described in the documentation and I can see that the grid acts like expected.  I see the parent data but of course since I don't know where to put my second collection I see nothing when I press the + button.  Where's the second ItemsSource, How do I access the second grid ?

    The grid have my first collection of data in the ItemsSource and the grid is ready for hierarchy.  All I need now is to populate the child grid.  Thank you for any hints

  2. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 30 Oct 2010 Link to this post

    By the way, I have 2 collections of DataContract object that comes from WCF call
    I also tried this code which have a collection of Application inside my Customer Object which I populate

    foreach (GAM_Customer Customer in _Customers)
        Customer.Applications = new ObservableCollection<GAM_Application>(_Applications.Where<GAM_Application>(a => a.CustomerId == Customer.CustomerId).ToList());

    I still don't see the data in the child grid
    I can see that everything is tehre in place which is each Customer object having it's own collection of Applications
  3. DevCraft banner
  4. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 30 Oct 2010 Link to this post

    The code for the relation is here :

    rgvCustomers.ChildTableDefinitions.Clear();
    GridViewTableDefinition gtd = new GridViewTableDefinition() { Relation = new Telerik.Windows.Data.PropertyRelation("CustomerId") };
    rgvCustomers.ChildTableDefinitions.Add(gtd);
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 02 Nov 2010 Link to this post

    Hello Marc Roussel,

    I am sending you a sample project illustrating one possible way for defining Hierarchy Grids and setting their ItemsSource-s, using WCF RIA Services.
    Let me know if it helps and corresponds to your requirements.
     

    Kind regards,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 02 Nov 2010 Link to this post

    When I run the application I get this attached
  7. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 02 Nov 2010 Link to this post

    Sorry, there's nothing fonctional for me in there as I'm using just PURE WCF call,


    [DataContract]
    public class Customer
    {
    }

    and

    [DataMember]
    Properties
    {
    }

    A class which comes from a simple WCF call.

    Here's an example of it :
    [DataContract]
    public class GearPhoneItem
    {
        #region ' Fields '
            private int _PhoneID;
            private string _Ext;
            private string _PersonName;
            private string _Phone;
            private string _Department;
            private string _Email;
            #endregion
      
        #region ' Properties '
            [DataMember]
            public int PhoneID
            {
                get { return _PhoneID; }
                set { _PhoneID = value; }
            }
            [DataMember]
            public string Ext
            {
                get { return _Ext; }
                set { _Ext = value; }
            }
            [DataMember]
            public string PersonName
            {
                get { return _PersonName; }
                set { _PersonName = value; }
            }
            [DataMember]
            public string Phone
            {
                get { return _Phone; }
                set { _Phone = value; }
            }
            [DataMember]
            public string Department
            {
                get { return _Department; }
                set { _Department = value; }
            }
            [DataMember]
            public string Email
            {
                get { return _Email; }
                set { _Email = value; }
            }
            #endregion
    }


    When back from the GetCustomer and GetApplication , I populate my collections and this is done for 2 separate collection with a relation between them

    The class above is just an example of the object coming by from the Async call to the WCF service .svc.  There's no mention of Domain in there.  It's a pure call, nothing fency !
  8. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 02 Nov 2010 Link to this post

    Hello Marc Roussel,

    Basically, the reason for the exception is not caused by the RadGridView and you may use the project for a reference on the approach for setting the ItemsSource of the grids. However, the error you are getting may be due to the fact the .Web project is not the Start-up one. 

     

    Greetings,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 02 Nov 2010 Link to this post

    Let say I have 2 collections of object
    with a key relation in each different object

    how would you populate the grid in a hierarchy way ?
    Also, if it's about adding a collection of application in each distinct Customer,  that is something I already tried and nothing seems to appear on the chiuld grid

    Collection 1
        Customer1.CustomerId
            Collection2
                Application1.CustomerId
                Application2.CustomerId
        Customer2.CustomerId
            Collection2
                Application3.CustomerId
                Application4.CustomerId
        Customer3.CustomerId
            Colleciton2
                Application5.CustomerId
                Application6.CustomerId
  10. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 02 Nov 2010 Link to this post

    The Project.Web is really the one as startup and the .aspx is the page as startup
    however it doesn't work.  I tried to read everywhere where I have to take some code example in there that reflect what I need and I do not seem to figure out
  11. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 02 Nov 2010 Link to this post

    I already tried the collection of application INSIDE each customer and as I already mentioned, this was giviming only a blank child grid
    I will give you a repro project so we can work out this in the repro
  12. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 02 Nov 2010 Link to this post

    Created the ticket number 362861
    Thank you
Back to Top
DevCraft banner