You could use Groups for this. In this case, your grid would have 2 groups (Column 1 and Column 2) and 6 Columns (SubCol1, SubCol2, etc.)
Use the Groups property on the band to add a couple of groups, then assign the Group property on each column to the group you want.
Could you provide a bit more detail about how to correctly create the Column objects to be added to the Group's column collection. When I create a Column object and attempt to add it to the collection, I get the following exception "Can't add a null column or a column from a different band to a GroupColumns's collection". The Group property on the Column object appears to be ReadOnly.
Hi,
Columns come from the data source. So you should not need to create columns. You should bind your grid to a DataSource that contains the column structure you want. Then you handle the InitializeLayout event of the grid and add the Groups to the Band. Then you loop through the columns and assign each column to a group using the Group property on the column.
What kinda of Data Source will you be using here? If you don't really want to use data from a database and just want some data in-memory, I recommend using the UltraDataSource component. You could add 6 columns to the root Band and use this as your grid's data source.
Hi Dicky,
No, Groups are only one level, so you can't do this using Groups.
You might be able to do what you want using RowLayouts. You can add unbound columns to the grid and set the LabelPosition to LabelOnly, which gives you a column header with no cells and then you can position it to span across other columns like a header. The down side is that it's a column, not a group, so the user can't really move columns around effectively.
hi, is that a way to support sub-group? Like the following:
| group 1 | group 2 |
| subgroup1|subgroup2|subgroup3|subgroup4|
|col1|col2 |col3|col4 |col5 |col6 | col7|col8 |
subgroup1 and 2 under group 1.
Is it possible or any workaround?
Regards,
Dicky
Thanks for the reply, I now have a better understanding of how to bind columns to groups.