Hierarchical Grids using OpenAccess ObjectView

3 posts, 1 answers
  1. Axe
    Axe avatar
    88 posts
    Member since:
    Feb 2007

    Posted 13 Jul 2009 Link to this post

    I'm new to Winforms & OpenAcess and want to try the hierarchical grid functionality using OpenAccess and ObjectViews. Is this possible?. I started reading the coarseware for Telerik RadControls for Winforms but it uses Datasets. Having an asp.net background I'm not too keen on Datasets. I read online help for OpenAccess ObjectViewObjectProvider but can't see how to get child collections. Maybe this should be posted in OpenAccess but if you can provide info or sample that would be great.
  2. Answer
    Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 17 Jul 2009 Link to this post

    Hello Axe,

    In order to build hierarchy with Telerik RadGridView and OpenAcess windows forms components, you should do the following steps:
    • Create an ObjectProvider and ObjectView that load the objects from the root persistent type.(e.g. Order)
    • Create another ObjectProvider and ObjectView that load the persistent object that the child collection contains(e.g. OrderDetail)
    • Bind the RadGridView to the first objectView datasource.
    • Create a gridviewTemplate that is bound to the second objectView dataSource
    • Define the relation between the master and detail grid templates(ChildColumnNames and ParrentColumnNames have the value of the column that defines the relation - OrderID)
    We admit it  is a bit tricky at this stage. A Knowledge Base article will be provided soon in the form of a detailed walkthrough for our customers.

    We are sending you a sample project to make it easier for you to understand the workflow. It just requires the Northwind database on our machine to run properly.
     

    Kind regards,
    Zoran
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Axe
    Axe avatar
    88 posts
    Member since:
    Feb 2007

    Posted 17 Jul 2009 Link to this post

    Thank you for the sample. It was very easy. I tried on many different databases and always works as expected.

    One thing I couldn't work out is creating a  many-to-many relationship in the Grid such as in Northwind Employees and their Territories. I used 2 ObjectViews, 1 with Employees and the other with Territories and created the relationship on the EmployeeID for both ends but it's not quite right.
    Can you provide some detail on how that could be achived?
Back to Top