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

only summary row for all group levels

4 Answers 155 Views
GridView
This is a migrated thread and some comments may be shown as answers.
kevin
Top achievements
Rank 1
kevin asked on 24 Apr 2020, 07:31 PM

I am working on reporting system using the Telerik GridView.When I group and export in pdf a report, I need to show only summary row for all group levels.I have attached an example of what I need to do (winform telerik)

 Does any one have an suggestions on how to do this?

4 Answers, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 28 Apr 2020, 12:35 PM

Hello Kevin,

RadGridView offers the following useful properties:

  • ShowTotals - indicates whether total summary rows will be shown. They are calculated for the child rows of all groups and pinned at the top or bottom of all groups.
  • ShowSubTotals - indicates whether summary rows will be shown for each group. The property is only relevant when the grid is grouped.
  • ShowParentGroupSummaries - indicates whether the parent group summary row is visible when the grid is grouped.

If you want to show summary rows only for the groups, please refer to the following code snippet:

this.radGridView1.MasterTemplate.ShowTotals = false;
this.radGridView1.MasterTemplate.ShowSubTotals = true;
this.radGridView1.MasterTemplate.ShowParentGroupSummaries = true;

More information about summary rows is available here: https://docs.telerik.com/devtools/winforms/controls/gridview/rows/summary-rows

I hope this information helps. Should you have other questions do not hesitate to ask.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
kevin
Top achievements
Rank 1
answered on 29 Apr 2020, 05:04 PM

hi..Nadya

Thank you so much.. its working.... but when I export in PDF a report, I need to show only summary row for all group levels.Asshown in picture

0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 04 May 2020, 08:59 AM

Hello Kevin,

If I understand you correctly you would like to export to pdf only summary rows for all group levels (which means without exporting any data rows). I would like to note that GridViewPdfExport offers HiddenRowOption property that controls whether and how the hidden rows should be exported. To achieve your goal I can suggest you to go through the Radgridview.Rows collection and make the data rows not visible before exporting. Then set the HiddenRowOption to DoNotExport. Please refer to the following code snippet:

private void radButton1_Click(object sender, EventArgs e)
        {
            Telerik.WinControls.Export.GridViewPdfExport pdfExporter = new Telerik.WinControls.Export.GridViewPdfExport(this.radGridView1);
            pdfExporter.FileExtension = "pdf";
            pdfExporter.SummariesExportOption = Telerik.WinControls.UI.Export.SummariesOption.ExportAll;
            string fileName = @"..\..\export" + DateTime.Now.ToLongTimeString().Replace(":", "_") + ".pdf";
            
            foreach (var row in this.radGridView1.Rows)
            {
                if (row is GridViewDataRowInfo)
                {
                    row.IsVisible = false;
                }
            }
            pdfExporter.HiddenRowOption = Telerik.WinControls.UI.Export.HiddenOption.DoNotExport;
            pdfExporter.RunExport(fileName, new Telerik.WinControls.Export.PdfExportRenderer());
            Process.Start(fileName);
        }

Thus, following my project example from the previous post, if you have the RadGridView grouped by "Item Name" and "Quantity", the result after export to pdf should look like the following picture (only summary rows for each group level are shown):

I attached my sample project to this thread for your reference. Could you please refer to it and see how it works for you?

I hope this helps. If you need further assistance I will be glad to help.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
kevin
Top achievements
Rank 1
answered on 10 May 2020, 11:31 AM
Yes, that is exactly what I was looking for.Thank you so much.
Tags
GridView
Asked by
kevin
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
kevin
Top achievements
Rank 1
Share this question
or