I am trying to bind a WHDG to an IEnumerable Data source. It is pretty much a nested person set-up (Ex parent/child or boss/employee) and after it binds to the data source and loads the top level "person", any time I try to expand the grid to view the children it throws a KeyNotFoundException
I found this article which looks similar to what I'm trying to accomplish. Binding webhierarchicaldatagrid to ienumerable
I am a VB / WinForms programmer and the sample in that link is in C so I converted it (using teleric.com) & upgraded it to IG 18.2 and it throws the same error so I'm highly inclined to think it's something I'm doing wrong in the implementation.
The converted sample can be downloaded here (The zip file was too large to attach here - not a web developer so probably included too much needless crap):
https://americanelectricpower.box.com/s/h8lf3b7llk69n2gf8szha18v4zudxwba
If anyone can hep me figure out what I'm doing wrong I would greatly appreciate it.
Thanks!
Hello Stephen,
Thank you for contacting us. We really appreciate your effort for providing a sample application which reproduces your behavior. Your sample is looking all good, but your WebHierarchicalDataGrid is missing the DataKeyFields="CategoryID" property. You need to add this to your grid’s declaration:
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" Height="1350px" Width="1400px" DataKeyFields="CategoryID"/>
This should fix the exception that you are experiencing. If you have other questions, please feel free to ask.
Sincerely, Anastas
Hi Anastas,
I really appreciate your answer to my question and it did indeed fix the issue with that sample application. Unfortunately I am still having issues with my app.
I have been digging further and the Test app has a data source List (of Categories) with a property List (of Products) and the Hierarchy is only one level deep (Parent - Child)
In my project I only have one class ( Item ) that has a property of List (of Item) and the Hierarchy can, in theory, go to the Nth level deep. In actuality I have only seen about 7-10 levels deep with my data source.
I have created a new data source from an XML excerpt of my real data (redacted as required by employer) and put that as the data source of this same test app and it now throws the same error as my application.
"The given key was not present in the dictionary"
I have also taken these same data classes and used a WinForm & UltraWinGrid and it takes the same result set without a hiccup so it's bound to be something I'm doing wrong with the implementation / configuration of the WHDG but I have no clue what.
I am definitely not a Web Programmer and it shows, so I appreciate all the assistance you can give.
Test App V2
Thank you
Steve
I cannot access the TestAppV2 application from the provided link. It's redirecting me to a SingIn/Up page. Can you please re-deploy it, and provide an accessible link as this in your initial post. So I can download it and assists you.Regards,Anastas
My apologies - I have updated the link above and it should work now.
I've modified the attached sample in order to work for you. Hope that it match your requirements.
https://app.box.com/s/35qksc0p33wv9am5ko27qgse2sgj5o4a
Regards,Anastas