Grouping and Descriptors

2 posts, 0 answers
  1. Prashu
    Prashu avatar
    17 posts
    Member since:
    May 2013

    Posted 19 Oct 2013 Link to this post

    Hi All,
    Here is the situation for me.
    I have Profit and loss report

    My Requirement is shown in Attachment .. Please go through Grouping.png and come here

    for "Totals"  Template i calling in code behind as 

     if (e.Column.UniqueName == "Account_No")
                                    e.Column.Width = 120;
                                    e.Column.HeaderTextAlignment = TextAlignment.Left;
                                    var dataColumn = e.Column as GridViewDataColumn;
                                    dataColumn.DataFormatString = "{0:N2}";
                                    e.Column.TextAlignment = TextAlignment.Center;
                                    if (i == 1)
                                        e.Column.GroupFooterTemplate = (DataTemplate)VReportViewer.Resources["GroupFooterRowTemplate"];

    the string  "Totals" is Print after every Group using "ColumnGroupDescriptor " and  i'm grouping using below code

      if (this.ReportName == "Profit and Loss")
                               if (VReportViewer.GrdReport.Columns.Count == 9)
                                    Telerik.Windows.Controls.GridView.ColumnGroupDescriptor descriptor = new ColumnGroupDescriptor();
                                    descriptor.Column = VReportViewer.GrdReport.Columns["Account_Type"];

                                    SumFunction sum = new SumFunction();
                                    sum.ResultFormatString = "{0:c2}";

    and the Next Challenge I need to Group  next level i'm showing  example in attachment Please Help me to get these things
    Gothrough Grouping2.png

  2. Matt
    Matt avatar
    14 posts
    Member since:
    May 2012

    Posted 22 Oct 2013 Link to this post

    Grouping should be easy permitting your data is hierarchical.  For example your original item has a collection of items on it etc..Grids and subgrids kind of need that...but if your data is right something like this should work at each layer:

                    <telerik:GroupDescriptor x:Name="groupDescriptor" Member="Value using to group by here" SortDirection="Ascending"/>

    Formatting the Group:
                        <TextBlock Text="{Binding Header, StringFormat=''}" Margin="0,0,50,0"/>

    Footer on column where 'Total' should show up:
                           <TextBlock Text="Total" FontWeight="Bold" HorizontalAlignment="Left"/>

    Footer where total value is:
                            <telerik:SumFunction SourceField="Source Field Here" ResultFormatString="{}{0:c0}"/>

    Should be able to do all this in the XAML and not in the code behind or any special behavior.  Hope that helps.
  3. DevCraft banner
Back to Top