New Posts New Posts RSS Feed: DevExpress Grid
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

DevExpress Grid

 Post Reply Post Reply
Author
pucsoftware View Drop Down
Groupie
Groupie
Avatar

Joined: 15-Apr-2008
Location: United States
Posts: 46
Post Options Post Options   Quote pucsoftware Quote  Post ReplyReply Direct Link To This Post Topic: DevExpress Grid
    Posted: 06-Nov-2008 at 11:34am
I have a newly converted DevForce classic to DevForce EF application. I was using the DevExpress grid control heavily in the application, but I am having problems in the new EF version. When trying to bind a parent view with a child view in the grid the child relationships are not recognized in the child view. Usually, this link is established by using the ChildGridLevelName property of the ParentView and setting this value, as well as the Child level of the child view, to the same name. This is supposed to be the name of the property in the object that denotes the relationship.
 
For example if I have an Object named Departments with a property that is a collection of Employees, by setting the relationship properties with the name of "Employees", the grid will recognise the collection of child objects. From there the designer can retrieve all the fields. I can't seem to get this to work now. Has anyone else run into this? If so, what's the fix?
 
puctx
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 11-Nov-2008 at 10:02am

This advice is taken from porting a DevEx Hierarchical Grid from DevForce Classic to DevForce EF.

 
Assume that Customer is parent object and Order is the child object.  
 
             Try using a BindableList as the DataSource. The BindableList has special code that allows it to operate with advanced features of various grids.  So just move the results of your EF queries into a BindableLists.

  

                Try creating a new property on you customer object called “Orders2”.  This property should be a BindableList<Order>.  Then bind to Orders2 instead of Orders in your AddRelationView line.

 

Here is the custom property on Customer:

 

    public BindableList<Order> Orders2 {

      get {

        BindableList<Order> mOrders = new BindableList<Order>();

        mOrders.AddRange(this.Orders);

        return mOrders;

      }

    }

 

Here is the final code for the nested grid:

  

      _ordersXGBM.GridView = _customersXGBM.AddRelationView("Order", "Orders2");

      this.gridView2.LayoutChanged();

      _ordersXGBM.GridView.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;

 

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down