views:

96

answers:

1

I have a UltraWinGrid that is bound to a DataSet, in which a couple of columns are themselves of a collection class type, like so :-

[Name] - string

[Description] - string

[Components] = List<Component>

[Levels] = List<Level>

Currently, these last two fields are hidden columns when bound to the datagrid and used to determine the data to bind two other datagrids on the form.

In order to provide a print view of the screen, I need to make the other two datagrids children of the first datagrid's rows, like so :-

  • Item1 Name | Item1 Description
    • Components
      • Component1 Name | Component1 Value
      • Component2 Name | Component2 Value
    • Levels
      • Level1 Name | Level1 Value
      • Level2 Name | Level2 Value
  • Item2 Name | Item2 Description
    • Components
      • Component1 Name | Component1 Value
      • Component2 Name | Component2 Value
    • Levels
      • Level1 Name | Level1 Value
      • Level2 Name | Level2 Value

I suspect I need to make a new merged dataset, possibly with DataRelations, but I'm struggling to figure out how to bring the data out correctly.

Can anyone steer me in the right direction?

A: 

Ok, think I've solved this one (albeit needs a little tidying up). The trick is to pull the "parent" data out into a List (currently with an ugly foreach loop) and bind the grid to that, ensuring you're grid is set to MultiBand.

Since the two child collections are also List collections it handles them automagically.

Discovered the solution with the help of this answer, which I shall vote up to show my appreciation.

Rob Cowell