Print Page | Close Window

Updateable Nested GridView

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=970
Printed Date: 10-Jun-2026 at 7:09pm


Topic: Updateable Nested GridView
Posted By: rclarke
Subject: Updateable Nested GridView
Date Posted: 18-Oct-2008 at 8:38am
I have implemented a nested DevExXtraGrid View by using AddRelationView but I want to be able to add and delete items for the child relation within the grid. Since the relation of one to many defaults to a readonly entitylist, I can't do what I want. I would like the child view to be driven by an EntityList and BindingSource which allow new items via the BindingSource.AddNew and the rremoval of selected items as well. In other words I want to be able to do everything in the child grid view that I can do in the parent.

I know I can use two grids to accomplish this but screen real estate is an issue and seperate grids uses a lot of space.

Any help would be appreciated.



Replies:
Posted By: davidklitzke
Date Posted: 22-Oct-2008 at 3:13pm

I spent several days last year with one customer on this same issue.  In the end, we  got stuck on the issue that we could not get an AddingNew event to fire even though we did all of the same things that are done in a standard Master-Detail configuration.  In a standard Master-Detail grid, the AddingNew event will fire as soon as you start typing into the bottom row.  This event does not fire in the DevEx hierarchical grid.

If I were to pick up on this same issue again, I would start by asking DevExpress Technical Support to explain how to get this event to fire.



Posted By: rclarke
Date Posted: 23-Oct-2008 at 8:00am
David,
Thanks for the reply. I can't even get to the point that I can debug the AddingNew event because it seems to me that the DevEx XtraGrid is seeing the data for the child relation as readonly. For example, if there are no child entities, the expansion button to expand the view is greyed out. If there are existing child entities, I can expand the view to show them and the DevEx Embedded Navigator changes to reflect the child view but the buttons to Add and Delete are greyed out. I think this is due to the fact that DevForce presents the data as readonly because of the relation. I don't know how to override this behavior and provide my own Entitylist and associated BindingSource. So right now I can't go to Developer Express with an issue because I can't make it happen or not happen as the case may be.



Posted By: GregD
Date Posted: 23-Oct-2008 at 10:05am
Originally posted by rclarke

David,
Thanks for the reply. I can't even get to the point that I can debug the AddingNew event because it seems to me that the DevEx XtraGrid is seeing the data for the child relation as readonly. For example, if there are no child entities, the expansion button to expand the view is greyed out. If there are existing child entities, I can expand the view to show them and the DevEx Embedded Navigator changes to reflect the child view but the buttons to Add and Delete are greyed out. I think this is due to the fact that DevForce presents the data as readonly because of the relation. I don't know how to override this behavior and provide my own Entitylist and associated BindingSource. So right now I can't go to Developer Express with an issue because I can't make it happen or not happen as the case may be.

 
>> I don't know how to override this behavior and provide my own Entitylist and associated BindingSource. 
 
Just code a property into the parent class that returns an EntityList:
 
public EntityList<Order> OrdersUnconstrained {  
   get {
      return new EntityList<Order>(this.Orders);
   }
}
 
>> the DevEx Embedded Navigator changes to reflect the child view but the buttons to Add and Delete are greyed out.
 
How to Enable the buttons would be a question for DevEx. If you can do it, there might be a secondary issue of taking charge of the behavior that occurs when they're clicked.
 
This is just a stab in the dark, but...when you work with a .NET BindingNavigator, which has Add and Delete buttons on it, you have to null out a couple of properties of the BindingNavigator itself to disengage built-in handlers that don't know anything about entities in a local cache, and so attempt to do the wrong things.  Once you've nulled out those properties, the buttons are just plain old buttons, and you can wire handlers to them, and code any sort of action in those handlers.
 


Posted By: rclarke
Date Posted: 23-Oct-2008 at 10:49am

Sometimes, I can't see the forest for the trees. Thanks, Greg. For some reason I was thinking that I had to reference the relation property which always returns a readonlyentitylist. I still get the same behavior so, as usual you guys are right; it appears that Developer Express does not work as I had hoped.



Posted By: GregD
Date Posted: 23-Oct-2008 at 4:02pm
Fortunately for our humility, being right never lasts for very long.  8-)
 
Sorry for your difficulties.



Print Page | Close Window