only summary row for all group levels

5 posts, 1 answers
  1. kevin
    kevin avatar
    4 posts
    Member since:
    Apr 2020

    Posted 24 Apr Link to this post

    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?

  2. Nadya
    Admin
    Nadya avatar
    307 posts

    Posted 28 Apr Link to this post

    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.
  3. kevin
    kevin avatar
    4 posts
    Member since:
    Apr 2020

    Posted 29 Apr Link to this post

    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

  4. Answer
    Nadya
    Admin
    Nadya avatar
    307 posts

    Posted 04 May Link to this post

    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.
  5. kevin
    kevin avatar
    4 posts
    Member since:
    Apr 2020

    Posted 10 May Link to this post

    Yes, that is exactly what I was looking for.Thank you so much.
Back to Top