Binding Hierarchical WebGrid to Custom Objects

4 replies. Last post: May 4, 2010 10:37 PM by Andi Santoso
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

Hi,

I'm using your sample from the WebGrid samples project "BindtoHierchicalCustomObject.aspx" however I am not using the ISDataSource to retrieve the data and I'm getting errors when I try to bind the grid.

My parent collection is called "EDMCollection" and implements all the necessary interfaces in the same way as your sample "CustomerCollection" does. "EDMCollection" has elements of type "BrokerEDM" and a child collection of type "PortfolioCollection". "PortfolioCollection" has child elements of type "BrokerEDMPortfolio".

I have a separate method (in a Controller class) that pulls all the data as a flat generic list and then pass this into the constructor of my "EDMCollection" and then use LINQ to build my EDMCollection / PortfolioCollection (Parent / Child collections) from the flat generic list passed in teh constructor.  This means EDMCollection and child PortfolioCollection is fully populated before I bind grid, but I get errors.

Will this approach work?  My code is attached.

1 attachment
All times are GMT -5. The time now is 4:16 PM.
Previous Next