Hi,
I am trying to use the WebHierarchicalDatagrid to display an 'n' level data structure using load on demand. My data is a stock control type system with a root node of 'Location' in which there are 1 or more instances of a 'Component'. Each 'Component' may have child components which in turn may themselves have child components - to any level really.
Location Component Component Component ...
I already have a LOCATION and COMPONENT object returned from my Data Access Layer. I have created the grid with AutoGenerateBands and AutoGenerateColumns DISABLED as I do not want to display all of the data in the LOCATION or COMPONENT objects
I have created 2 bands so far to test the structure. Band 0 will display the location and as I only want to display its name I have created a bound column and set its DataFieldName to 'Name' which is the property of the LOCATION object which returns the name. I have also set the DataKeyFields property of the band to ID as this is the name of the property of LOCATION which returns the database ID.
My second (child) band has 2 columns, Part Number and Description. These are also bound to the appropriate members of the LOCATION object.
My Page_load event populates the root band by adding a single LOCATION object to a list and using this as the DataSource - for some reason the Grid then crashes with
Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid.DataBind() +1082 An item with the same key already exists
I have only added 1 item to the grid.
Help please as I'm not even sure that I am approaching this the right way.
Are there any samples with behaviors within the child band? When I added behaviors to my child band, I stopped seeing Container.Level > 1 in Row_Updating. All of the samples I've seen have no behaviors in the child band.
Should I expect Cell Editing to work with behavior code in the child band?
Hello,
Let me know if you need further assistance.
Thanks.
Hello Chris,
Thank you for you post.
At this point is hard to me to say what is the real reason behind this issue because I need of some code to be able to run and debug. I would like to share with you a sample, that implements Manual CRUD (Create Read Update Delete) operation with WebHierarchicalDataGrid.
http://forums.infragistics.com/members/RMinchev/files/WHDG+-++Manual+CRUD/WHDG_5F00_Manual_5F00_Crud.zip.aspx
More live samples (source code as well ) are located here: http://samples.infragistics.com/2010.3/WebFeatureBrowser/Default.aspx
Hope it will helps.
I have also just tried setting the grid to auto-generate bands and columns - works for the first level but when I try to add expanded items using the following code:-
// Create Container GridContainerGrid childGrid = new ContainerGrid();e.Row.RowIslands.Add(childGrid);
// Bind GridchildGrid.DataKeyFields = "ID";childGrid.Level = e.Row.Level + 1;childGrid.DataSource = listComponents;childGrid.DataBind();
I get an exception thrown of :- The given key was not found in the dictionary
I assume it is referring to the DataKeyFields set to 'ID@ which I know is the property to return the database ID of the component and does exist as a property of the Component object.