We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Custom Collection as Datasource in Heirarchical GDBG / Virtual Grid

Hello, For this discussion I''ll be referring to the CustomersVirt sample (Samples\DataBound\Hierarchical\CustomersVirt\CS\). But first let me explain a bit about my requirements before I dwelve into the crux of the problem. I have the following objects: LeagueGroup, League and Contest. A LeagueGroup is a container for Leagues, a League is a container for Contests. All of then inherit from a base class called SummaryBase (they all provide summarized information). The children collections are implemented using an extended CollectionBase as in the CustomersVirt sample. The main issue is that not all Leagues belong to a LeagueGroup. Leagues that do not have a "parent" so to speak are on the same "heirarchy level" as a LeagueGroup. Making the dataset approach a bit messy as I would have to have multiple columns accomodating for every scenario and filling in the dataset was problematic as well. So I opted for a custom collection that made the relationships more transparent and easier to understand and manipulate. As far as visual requirements a root level LeagueGroup/League should be an expandable row that will show its League/Contest children and in the case of Leagues provide a third level to show the Contests. So there''s a variable 2-3 heirarchy levels in the grid. My original approach was using a Virtual grid and attaching the QueryRowCount, QueryColCount and QueryCellInfo events. This however led me to be unable to expand/collapse child row tables or even know how to define them. I did not want or intend to implement that entire functionality if I could avoid it. The CustomersVirt sample seemed to provide me with what I needed though (custom datasource with heirarchical views) Everything works as expected in the CustomersVirt example, except when not all objects in the collection have "children". In the sample if I comment out adding children to the original customers I get a NullReferenceException, because apparently it cannot query the Children collection. Given that a LeagueGroups or League in my scenario might come with or without children (Depending on the exact query) this is unacceptable. Additionally, in the case of the 3rd Heirarchy level, not all rows will drill down to the third level. How exactly is the binding done when calling AddRelation(propertyName) and how can I make it more reliable or robust? We are currently using ver 2.x of the Grid if this is fixed or improved upon in later versions it would be helpful to know that. As whatever can speed up this will be very helpful. Thanks for reading

Loader.
Live Chat Icon For mobile
Up arrow icon