Hi,
I would like to implement Hierarchal grid functionality in ultragrid. I have 5 tables like A,B,C,D and E. in which A is parent of B, B is parent of C, C is Parent of D and D is parent of E. I have created Collection and singular class for each of the table. Now please suggest how i use these calsses so that the i can show the records in UltraGrid as shown below:
Thanks
Anupam Shukla
You mentioned a whole lot of attachments here, but there is nothing attached to your post, other than a screen shot.
Anyway, this appears to be a problem with the structure of the data source you are binding to. The DotNet BindingManager gets the data structure from the first object in the list at each level. So you have to make sure that your data is homogenous and also that the BindingManager can get the entire structure up-front.
For example, let's say you have a BindingList<Class A> that you are binding to the grid. When you bind, the BindingManager in DotNet will examine the properties of the first item (the first Class A object) in the list and use those as the fields that display as columns in the grid.
If Class A has a property which returns a BindingList<Class B>, then the BindingManager will try to get the first item in the child list of the first Class A object in the parent list. If the first Class A object happens to return null for it's Class B list, or it returns no items, then the BindingManager will be unable to determine the structure. In that case, the BindingManager will try to use the IEditableObject interface to add an item to the list, get it's structure and then cancel the add.
This process happens all the way down the hierarchy. So it looks to me like your data source probably has a parent row with a child row and that first child row has has a problem with it's child rows. Perhaps there simply are no child rows at the time of binding. Or perhaps the BindingManager cannot get all the properties of the object because the list is of a base type and objects on the list are derived types.
If possibel the please suggest it with some example or please give me some url which has this type of implementation.
Please help me to solve the issue that I am facing. I have created a class to access data from DataBase (as attached RigClass.cs). This is using base project as attached DataLayerBase.zip. By using DataLayerBase project we are inheriting the class from database.
Now I have created a bindable as attached RigItemBindable.cs (RigItemBindable.Designer.cs) which is using attached CollectionComponetT.cs ( as attached).
Now I can see only 2-level of data. Below this depth I am not able to access the data.
In attached zip file we are binding the grid by using following:
grid.datasource=objRigItemBindable;
I am not able to update files. Please suggest that how i can?
Also if possibel the please suggest it with some example or please give me some url which has this type of implementation.
Just to add a little to what Brian wrote... You would probably want to bind the grid to a list which contains class A objects.
Also, if the data needs to be updateable by the user, then I strongly recommend using IBindingList instead of IList. IList is not a robust interface for binding. So the easiest thing to do would be to use BindingList<T> to create a list of "A" objects and to have each object A expose a BindingList<T> or "B" objects, etc.
If Class A exposes a property of a type that implements IList, the grid will interpret that property as a "chaptered" column, and create a child band for it. If that list property contains instance of class B, that class will define the structure for that band. This applies in a hierarchical manner so that if class B also exposes an IList property, and that list contains instance of class C, class B's band will also have a child band, etc.