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
20
Grouping columns from the same DataSource.
posted

Hello,

I developed a software that contains a datagrid with many columns. I just bought the plugin with Wingrid and want to change the style without changing the calls to the TableAdapter and then the datasource (if possible).
I want to group these columns on 2 rows (a main row with collapse button for the second row) to improve visibility but I can not create a link with the existing datasource without him redo the basic pattern.

 

Thanks a lot for your help.

Phil

  • 469350
    Suggested Answer
    Offline posted

    Hi Phil, 

    I'm not sure I understand your question.

    It sounds like you are saying you have a flat table of data and you want to create a hierarchy with parent and child rows in the grid.

    There are two ways to get a hierarchy in the grid.

    One is to bind to a hierarchical data source, like a DataSet that has multiple tables and relationships.

    The other is to use the OutlookGroupBy feature in the grid. This allows you to group the data by column. To do this, you need to set the ViewStyleBand on the grid to OutlookGroupBy. Then you drag a column header into the GroupByBox at the top of the grid. Or... you can group in code by adding a column to the SortededColumns collection of the band. Something like this:

    this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add(this.ultraGrid1.DisplayLayout.Bands[0].Columns["my column"], false, true);