This is a migrated thread and some comments may be shown as answers.

Grouping and Descriptors

1 Answer 123 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Prashu asked on 19 Oct 2013, 02:38 PM
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

1 Answer, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 22 Oct 2013, 03:24 PM
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.
Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Share this question