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
1300
Datarelation and ultragrid
posted

I have a datatable like this :

Quantity   Price   Date     Comment
50         20      10/15    Buy 160
40         15      10/15    Buy 160
60         14      10/15    Buy 160
35         22      10/16    Buy 276
44         16      10/16    Buy 276
78         13      10/16    Buy 276
96         19      10/16    Buy 276
23         2       10/16    Buy 276

I want to see this in a ultragrid where the mother table are

Date Comment
10/15    Buy 160
and
10/16    Buy 276

and the child table are :

50         20      10/15    Buy 160
40         15      10/15    Buy 160
60         14      10/15    Buy 160
and
35         22      10/16    Buy 276
44         16      10/16    Buy 276
78         13      10/16    Buy 276
96         19      10/16    Buy 276
23         2       10/16    Buy 276

I know that I should use datarelation but I don't really know how Thanks fro your help

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    If this is all in a single table, then you don't need a DataRelation. You could do this with the grid using OutlookGroupBy.

    All you have to do is set ViewStyleBand to OutlookGroupBy.

    Then use this to group by the Date column:

    grid.DisplayLayout.Bands[0].SortedColumns.Add("Date", false, true)

    If the two fields are always the same, then you can group by either one. If you need to group by a unique pairing of the values, then you could group by both and create two levels, or you could use a GroupByComparer.

     

Children
No Data