Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
WebHierarchicalDataGrid bound to IEnumerable - keynotfoundexception
posted

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!

Parents
No Data
Reply
  • 5600
    Offline posted

    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

Children