Completed
Last Updated: 11 Oct 2023 10:09 by ADMIN
Release R3 2023
Nikolas
Created on: 07 Jun 2023 10:06
Category: GridView
Type: Bug Report
0
RadGridView: GridViewSpreadExport duplicates parents rows with no child records when exporting all child tabs

To reproduce:

      public RadForm1()
      {
         InitializeComponent();
         PopulateGrid();
      }

      private void radButton1_Click(object sender, EventArgs e)
      {
         GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1);
         SpreadExpo

rtRenderer exportRenderer = new SpreadExportRenderer();
         spreadExporter.ExportHierarchy = true;
         spreadExporter.ExportVisualSettings = true;
         spreadExporter.ChildViewExportMode = Telerik.WinControls.UI.Export.ChildViewExportMode.ExportAllViews;

         string fileName = @"..\..\exportedFile" + DateTime.Now.ToLongTimeString().Replace(":", "_") + ".xlsx";
         spreadExporter.RunExport(fileName, exportRenderer);
         Process.Start(fileName);
      }

      public void PopulateGrid()
      {
         List<GridResults.ChildCollectionFirst> firstCollection = new List<GridResults.ChildCollectionFirst>
         {
            new GridResults.ChildCollectionFirst
            {
               Test1 = "First Child"
            }
         }.ToList();

         List<GridResults.ChildCollectionSecond> secondCollection = new List<GridResults.ChildCollectionSecond>
         {
            new GridResults.ChildCollectionSecond
            {
               Test2 = "Second Child"
            }
         }.ToList();

         List<GridResults.ChildCollectionThird> thirdCollection = new List<GridResults.ChildCollectionThird>
         {
            new GridResults.ChildCollectionThird
            {
               Test3 = "Third Child"
            }
         }.ToList();

         List<GridResults.ChildCollectionFourth> fourthCollection = new List<GridResults.ChildCollectionFourth>
         {
            new GridResults.ChildCollectionFourth
            {
               Test4 = "Fourth Child"
            }
         }.ToList();


         var resultsList = new List<GridResults>
         {



            new GridResults
            {
               Id = "First Parent",
               Value = "Test Value 1",
               ChildCollection1 = new List<GridResults.ChildCollectionFirst>(),

               ChildCollection2 = new List<GridResults.ChildCollectionSecond>(),

               ChildCollection3 = new List<GridResults.ChildCollectionThird>(),

               ChildCollection4 = new List<GridResults.ChildCollectionFourth>()
            },
            new GridResults
            {
               Id = "Second Parent",
               Value = "Test Value 2",
               ChildCollection1 = firstCollection,

               ChildCollection2 = secondCollection,

               ChildCollection3 = thirdCollection,

               ChildCollection4 = fourthCollection
            },

            new GridResults
            {
            Id = "Third Parent",
            Value = "Test Value 3",
            ChildCollection1 = new List<GridResults.ChildCollectionFirst>(),

            ChildCollection2 = new List<GridResults.ChildCollectionSecond>(),

            ChildCollection3 = new List<GridResults.ChildCollectionThird>(),

            ChildCollection4 = new List<GridResults.ChildCollectionFourth>()
         },
            new GridResults
            {
               Id = "Fourth Parent",
               Value = "Test Value 4",
               ChildCollection1 = new List<GridResults.ChildCollectionFirst>(),

               ChildCollection2 = new List<GridResults.ChildCollectionSecond>(),

               ChildCollection3 = new List<GridResults.ChildCollectionThird>(),

               ChildCollection4 = new List<GridResults.ChildCollectionFourth>()
            },
            new GridResults
            {
            Id = "Fifth Parent",
            Value = "Test Value 5",
            ChildCollection1 = new List<GridResults.ChildCollectionFirst>(),

            ChildCollection2 = new List<GridResults.ChildCollectionSecond>(),

            ChildCollection3 = new List<GridResults.ChildCollectionThird>(),

            ChildCollection4 = new List<GridResults.ChildCollectionFourth>()
         },
         new GridResults
         {
            Id = "Sixth Parent",
            Value = "Test Value 6",
            ChildCollection1 = new List<GridResults.ChildCollectionFirst>(),

            ChildCollection2 = new List<GridResults.ChildCollectionSecond>(),

            ChildCollection3 = new List<GridResults.ChildCollectionThird>(),

            ChildCollection4 = new List<GridResults.ChildCollectionFourth>()
         }

         };
      //   radGridView1.BeginUpdate();
         radGridView1.DataSource = resultsList;
      //   radGridView1.EndUpdate();

            foreach (GridViewTemplate t in this.radGridView1.Templates)
            {
                t.AutoSizeColumnsMode= GridViewAutoSizeColumnsMode.Fill;
            }
      }

   public class GridResults
   {
      [DisplayName("ID")]
      public string Id { get; set; }

      [DisplayName("Value")]
      public string Value { get; set; }

      [DisplayName("Child Collection 1")]
      public List<ChildCollectionFirst> ChildCollection1 { get; set; }

      [DisplayName("Child Collection 2")]
      public List<ChildCollectionSecond> ChildCollection2 { get; set; }

      [DisplayName("Child Collection 3")]
      public List<ChildCollectionThird> ChildCollection3 { get; set; }

      [DisplayName("Child Collection 4")]
      public List<ChildCollectionFourth> ChildCollection4 { get; set; }

      [DisplayName("Child Collection 1")]
      public class ChildCollectionFirst
      {
         [DisplayName("Test Header")]
         public string Test1 { get; set; }
      }

      [DisplayName("Child Collection 2")]
      public class ChildCollectionSecond
      {
         [DisplayName("Test Header 2")]
         public string Test2 { get; set; }
      }

      [DisplayName("Child Collection 3")]
      public class ChildCollectionThird
      {
         [DisplayName("Test Header 3")]
         public string Test3 { get; set; }
      }

      [DisplayName("Child Collection 4")]
      public class ChildCollectionFourth
      {
         [DisplayName("Test Header 4")]
         public string Test4 { get; set; }
      }
   }

The observed result with duplicated rows is demonstrated here:

 

1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 07 Jun 2023 10:21

Hello, Nikolas,

Thank you for bringing this to our attention. Due to the specificity of the issue, we are unable to suggest an appropriate stable solution. That is why I have increased its priority and escalated it to the developers. We will do our best to introduce a fix or working solution accordingly.

Please excuse us for the inconvenience caused. Make sure that you follow this item in order to get notified once any status changes occur.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.