Internal NullReferenceException in Table.ForEachCell() when building dynamic tables

4 posts, 0 answers
  1. Martin
    Martin avatar
    34 posts
    Member since:
    Oct 2012

    Posted 18 Sep 2014 Link to this post

    Hello Telerik team,

    in my report I have to build more than one table dynamically. I want to display one table for each item of a list and I fetch the data from another source. I've looked in the designer how a table is build that will display a list and it's content row by row for every item.

    So here I have build my code in the initialization:

    protected void Report_Load()
            {
                this.DataSource = this.obj;
     
                #region Generierung der Komponenten-Tabellen
                // Für jede Komponentengruppe müssen wir eine Tabelle im Report dynamisch erstellen.
                int cgid = 0; // Component Group ID
                foreach (PRODUKTKOMPONENTENGRUPPE componentGroup in this.obj.Lizenz.PRODUKTVERSION.PRODUKTKOMPONENTENGRUPPE.OrderBy(x => x.SortNo))
                {
                    TextBox lComponentGroup = new TextBox() // Komponentengruppe - Überschrift
                    {
                        Name = "lComponentGroup" + cgid.ToString(),
                        Location = new PointU(Unit.Cm(cgid * 2), Unit.Cm(0)), // Location anhand ID im Panel
                        Size = new SizeU(LicenseReport.MaxWidth, Unit.Cm(0.5)),
                        Value = componentGroup.Name + ":"
                    };
                    lComponentGroup.Style.Font.Italic = true;
                    lComponentGroup.Style.BorderColor.Top = Color.Gray;
                    lComponentGroup.Style.BorderStyle.Top = BorderType.Outset;
                    lComponentGroup.Style.VerticalAlign = VerticalAlign.Middle;
                    this.pComponentGroups.Items.Add(lComponentGroup);
     
                    //// Die Tabelle für eine Komponentengruppe:
                    Table tComponentGroup = new Table() // Tabelle
                    {
                        Name = "tComponentGroup" + cgid.ToString(),
                        Location = new PointU(Unit.Cm(0), lComponentGroup.Location.Y + lComponentGroup.Size.Height),
                        Size = new SizeU(LicenseReport.MaxWidth, Unit.Cm(1))
                    };
                    tComponentGroup.Body.Columns.AddRange(new TableBody.ColumnCollection() // Spalten erstellen und Breiten setzen
                    {
                        new TableBodyColumn(LicenseReport.MaxWidth / 16 * 4),
                        new TableBodyColumn(LicenseReport.MaxWidth / 16 * 7),
                        new TableBodyColumn(LicenseReport.MaxWidth / 16 * 2.5),
                        new TableBodyColumn(LicenseReport.MaxWidth / 16 * 2.5),
                    }); // row width
     
                    // Controls für die Spaltenköpfe erstellen und die Spaltenköpfe mit ihnen füllen:
     
                    TextBox tbComponentColumnKey = new TextBox()
                    {
                        Name = "tbComponentColumnKey" + cgid.ToString(),
                        Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                        Value = "Schlüssel"
                    };
                    tbComponentColumnKey.Style.Font.Bold = true;
                    tComponentGroup.Items.Add(tbComponentColumnKey);
                    tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnKey });
     
                    TextBox tbComponentColumnName = new TextBox()
                    {
                        Name = "tbComponentColumnName" + cgid.ToString(),
                        Size = new SizeU(tComponentGroup.Body.Columns[1].Width, Unit.Cm(0.5)),
                        Value = "Name"
                    };
                    tbComponentColumnName.Style.Font.Bold = true;
                    tComponentGroup.Items.Add(tbComponentColumnName);
                    tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnName });
     
                    TextBox tbComponentColumnUnitPrice = new TextBox()
                    {
                        Name = "tbComponentColumnUnitPrice" + cgid.ToString(),
                        Size = new SizeU(tComponentGroup.Body.Columns[2].Width, Unit.Cm(0.5)),
                        Value = "Stückpreis"
                    };
                    tbComponentColumnUnitPrice.Style.Font.Bold = true;
                    tComponentGroup.Items.Add(tbComponentColumnUnitPrice);
                    tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnUnitPrice });
     
                    TextBox tbComponentColumnTotalPrice = new TextBox()
                    {
                        Name = "tbComponentColumnTotalPrice" + cgid.ToString(),
                        Size = new SizeU(tComponentGroup.Body.Columns[3].Width, Unit.Cm(0.5)),
                        Value = "Preis"
                    };
                    tbComponentColumnTotalPrice.Style.Font.Bold = true;
                    tComponentGroup.Items.Add(tbComponentColumnTotalPrice);
                    tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnTotalPrice });
     
     
                    tComponentGroup.Body.Rows.Add(new TableBodyRow(Unit.Cm(0.5))); // Zeilen erstellen / row height
                    // (Wir erstellen nur eine Reihe die dynamisch für jedes Item in die Tabelle angefügt wird)
     
                    // Controls erstellen, und Zeilen mit Controls füllen:
     
                    TextBox tbComponentCellKey = new TextBox()
                    {
                        Name = "tbComponentCellKey" + cgid.ToString(),
                        Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                        Value = @"=Key"
                    };
                    tComponentGroup.Items.Add(tbComponentCellKey);
                    tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellKey);
     
                    TextBox tbComponentCellName = new TextBox()
                    {
                        Name = "tbComponentCellName" + cgid.ToString(),
                        Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                        Value = @"=Name"
                    };
                    tComponentGroup.Items.Add(tbComponentCellName);
                    tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellName);
     
                    TextBox tbComponentCellUnitPrice = new TextBox()
                    {
                        Name = "tbComponentCellUnitPrice" + cgid.ToString(),
                        Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                        Value = @"=UnitPrice"
                    };
                    tComponentGroup.Items.Add(tbComponentCellUnitPrice);
                    tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellUnitPrice);
     
                    TextBox tbComponentCellTotalPrice = new TextBox()
                    {
                        Name = "tbComponentCellTotalPrice" + cgid.ToString(),
                        Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                        Value = @"=TotalPrice"
                    };
                    tComponentGroup.Items.Add(tbComponentCellKey);
                    tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellKey);
     
                    TableGroup tgComponentDetailGroup = new TableGroup() // Detailgruppe für den dynamischen Teil (notwendig)
                    {
                        Name = "DetailGroup"
                    };
                    tgComponentDetailGroup.Groupings.Add(new Grouping(null));
                    tComponentGroup.RowGroups.Add(tgComponentDetailGroup);
     
                    // Zum Panel hinzufügen und Daten anbinden:
                    this.pComponentGroups.Items.Add(tComponentGroup);
                    tComponentGroup.DataSource = this.obj.Komponenten.Where(x => x.GroupName.Equals(componentGroup.Name)).OrderBy(x => x.SortNo);
     
                    cgid++;
                }
                this.pComponentGroups.Height = Unit.Cm(cgid * 2);
                this.pComponentGroups.Style.BackgroundColor = Color.Transparent;
                #endregion
            }

    I call this method on load of the report, this.obj is my source for the whole report and so on. This passes without errors and when I debugged it, everything is attached right as I want it, the question is just, will this code cause any problems?

    Because even when I'm sure, after the page is loaded and the AJAX tries to get the report into the window I get this: 
    The full stack trace:
    [NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.]
    Telerik.Reporting.Processing.Table.ForEachCell(Action`1 action) +272
    Telerik.Reporting.Processing.Table.MeasureDataItemContent(IMeasureContext context, SizeRF availableClientSize) +428
    Telerik.Reporting.Processing.DataItem.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +178
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeRF availableClientSize) +225
    Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +86
    Telerik.Reporting.Processing.Panel.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +196
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeRF availableClientSize) +225
    Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +86
    Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +190
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +557
    Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +209
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +557
    Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +298
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.SubReport.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +141
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeRF availableClientSize) +225
    Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +86
    Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +190
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +557
    Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +209
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +557
    Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +298
    Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
    Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
    Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
    Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
    Telerik.Reporting.Processing.LayoutElement.MeasureElement(LayoutElement elementToMeasure, IMeasureContext context) +167
    Telerik.Reporting.BaseRendering.RenderingExtensionBase.MeasureReportCore(Report report, IMeasureContext measureContext) +54
    Telerik.Reporting.BaseRendering.RenderingExtensionBase.MeasureReport(Report report) +134
    Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +791
    Telerik.Reporting.Processing.ReportProcessor.CountPages(IList`1 reports, IRenderingContext renderingContext, Hashtable deviceInfo, ExtensionInfo extensionInfo, CreateStream createStreamCallback) +1001
    Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) +1520
    Telerik.Reporting.Processing.ReportProcessor.RenderCore(String format, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) +155
    Telerik.ReportViewer.WebForms.ReportPageOperation.RenderReport(String format, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext) +234
    Telerik.ReportViewer.WebForms.ReportRenderOperation.PerformOperationOverride() +622
    Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperationOverride() +214
    Telerik.ReportViewer.WebForms.HandlerOperation.PerformOperation(HttpContext context, ICacheManager cacheManager) +115
    Telerik.ReportViewer.WebForms.BasicHandler.ProcessRequest(HttpContext context) +438
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165


    This is caused by the 2nd request on the AJAX call, I've no idea how to debug it, please can you take a look at it?
  2. Martin
    Martin avatar
    34 posts
    Member since:
    Oct 2012

    Posted 18 Sep 2014 in reply to Martin Link to this post

    Here the image that shows it's the AJAX call, not my main request:

  3. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 23 Sep 2014 Link to this post

    Hi Martin,

    The following code works as expected:
    Report1 CreateReport()
          {
              var list = new List<PRODUKTKOMPONENTENGRUPPE> { new PRODUKTKOMPONENTENGRUPPE { Name = "test1", SortNo = "1", UnitPrice = 10, TotalPrice = 15, Key = 1 }, new PRODUKTKOMPONENTENGRUPPE { Name = "test2", SortNo = "2", UnitPrice = 10, TotalPrice = 15, Key = 1 } };
              var report = new Report1();
              var detail = report.Items.Find("detail1", true)[0] as Telerik.Reporting.DetailSection;
     
              #region Generierung der Komponenten-Tabellen
              // Für jede Komponentengruppe müssen wir eine Tabelle im Report dynamisch erstellen.
              int cgid = 0; // Component Group ID
              foreach (PRODUKTKOMPONENTENGRUPPE componentGroup in list)
              {
                  Telerik.Reporting.TextBox lComponentGroup = new Telerik.Reporting.TextBox() // Komponentengruppe - Überschrift
                  {
                      Name = "lComponentGroup" + cgid.ToString(),
                      Location = new PointU(Unit.Cm(cgid * 2), Unit.Cm(0)), // Location anhand ID im Panel
                      Size = new SizeU(Unit.Inch(1), Unit.Cm(0.5)),
                      Value = componentGroup.Name + ":"
                  };
                  lComponentGroup.Style.Font.Italic = true;
                  lComponentGroup.Style.BorderColor.Top = Color.Gray;
                  lComponentGroup.Style.BorderStyle.Top = BorderType.Outset;
                  lComponentGroup.Style.VerticalAlign = VerticalAlign.Middle;
                  detail.Items.Add(lComponentGroup);
     
                  //// Die Tabelle für eine Komponentengruppe:
                  Table tComponentGroup = new Table() // Tabelle
                  {
                      Name = "tComponentGroup" + cgid.ToString(),
                      Location = new PointU(Unit.Cm(0), lComponentGroup.Location.Y + lComponentGroup.Size.Height),
                      Size = new SizeU(Unit.Inch(1), Unit.Cm(1))
                  };
                  tComponentGroup.Body.Columns.AddRange(new TableBody.ColumnCollection() // Spalten erstellen und Breiten setzen
                  {
                      new TableBodyColumn(Unit.Inch(1) / 16 * 4),
                      new TableBodyColumn(Unit.Inch(1) / 16 * 7),
                      new TableBodyColumn(Unit.Inch(1) / 16 * 2.5),
                      new TableBodyColumn(Unit.Inch(1) / 16 * 2.5),
                  }); // row width
     
                  // Controls für die Spaltenköpfe erstellen und die Spaltenköpfe mit ihnen füllen:
     
                  Telerik.Reporting.TextBox tbComponentColumnKey = new Telerik.Reporting.TextBox()
                  {
                      Name = "tbComponentColumnKey" + cgid.ToString(),
                      Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                      Value = "Schlüssel"
                  };
                  tbComponentColumnKey.Style.Font.Bold = true;
                  tComponentGroup.Items.Add(tbComponentColumnKey);
                  tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnKey });
     
                  Telerik.Reporting.TextBox tbComponentColumnName = new Telerik.Reporting.TextBox()
                  {
                      Name = "tbComponentColumnName" + cgid.ToString(),
                      Size = new SizeU(tComponentGroup.Body.Columns[1].Width, Unit.Cm(0.5)),
                      Value = "Name"
                  };
                  tbComponentColumnName.Style.Font.Bold = true;
                  tComponentGroup.Items.Add(tbComponentColumnName);
                  tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnName });
     
                  Telerik.Reporting.TextBox tbComponentColumnUnitPrice = new Telerik.Reporting.TextBox()
                  {
                      Name = "tbComponentColumnUnitPrice" + cgid.ToString(),
                      Size = new SizeU(tComponentGroup.Body.Columns[2].Width, Unit.Cm(0.5)),
                      Value = "Stückpreis"
                  };
                  tbComponentColumnUnitPrice.Style.Font.Bold = true;
                  tComponentGroup.Items.Add(tbComponentColumnUnitPrice);
                  tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnUnitPrice });
     
                  Telerik.Reporting.TextBox tbComponentColumnTotalPrice = new Telerik.Reporting.TextBox()
                  {
                      Name = "tbComponentColumnTotalPrice" + cgid.ToString(),
                      Size = new SizeU(tComponentGroup.Body.Columns[3].Width, Unit.Cm(0.5)),
                      Value = "Preis"
                  };
                  tbComponentColumnTotalPrice.Style.Font.Bold = true;
                  tComponentGroup.Items.Add(tbComponentColumnTotalPrice);
                  tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnTotalPrice });
                  //Telerik.Reporting.Telerik.Reporting.TextBox
     
                  tComponentGroup.Body.Rows.Add(new TableBodyRow(Unit.Cm(0.5))); // Zeilen erstellen / row height
                  // (Wir erstellen nur eine Reihe die dynamisch für jedes Item in die Tabelle angefügt wird)
     
                  // Controls erstellen, und Zeilen mit Controls füllen:
     
                  Telerik.Reporting.TextBox tbComponentCellKey = new Telerik.Reporting.TextBox()
                  {
                      Name = "tbComponentCellKey" + cgid.ToString(),
                      Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                      Value = @"=Fields.Key"
                  };
                  tComponentGroup.Items.Add(tbComponentCellKey);
                  tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellKey);
     
                  Telerik.Reporting.TextBox tbComponentCellName = new Telerik.Reporting.TextBox()
                  {
                      Name = "tbComponentCellName" + cgid.ToString(),
                      Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                      Value = @"=Fields.Name"
                  };
                  tComponentGroup.Items.Add(tbComponentCellName);
                  tComponentGroup.Body.SetCellContent(0, 1, tbComponentCellName);
     
                  Telerik.Reporting.TextBox tbComponentCellUnitPrice = new Telerik.Reporting.TextBox()
                  {
                      Name = "tbComponentCellUnitPrice" + cgid.ToString(),
                      Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                      Value = @"=Fields.UnitPrice"
                  };
                  tComponentGroup.Items.Add(tbComponentCellUnitPrice);
                  tComponentGroup.Body.SetCellContent(0, 2, tbComponentCellUnitPrice);
     
                  Telerik.Reporting.TextBox tbComponentCellTotalPrice = new Telerik.Reporting.TextBox()
                  {
                      Name = "tbComponentCellTotalPrice" + cgid.ToString(),
                      Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                      Value = @"=Fields.TotalPrice"
                  };
                  tComponentGroup.Items.Add(tbComponentCellKey);
                  tComponentGroup.Body.SetCellContent(0, 3, tbComponentCellKey);
     
                  TableGroup tgComponentDetailGroup = new TableGroup() // Detailgruppe für den dynamischen Teil (notwendig)
                  {
                      Name = "DetailGroup"
                  };
                  tgComponentDetailGroup.Groupings.Add(new Grouping(null));
                  tComponentGroup.RowGroups.Add(tgComponentDetailGroup);
     
                  // Zum Panel hinzufügen und Daten anbinden:
                  detail.Items.Add(tComponentGroup);
                  tComponentGroup.DataSource = list;
     
                  cgid++;
              }
              detail.Height = Unit.Cm(cgid * 2);
              detail.Style.BackgroundColor = Color.Transparent;
              #endregion
     
              return report;
          }
    Report1 is a simple report created in Visual Studio, which has a single Detail section in it (named detail1).

    The only change is in the way items are set in the Body. In your code snippet all Textbox items are added in the first cell, which invalidates the Table item's structure.


    Additionally, it is not clear how you update the report. Please check your approach based on the AJAX support article.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  4. Martin
    Martin avatar
    34 posts
    Member since:
    Oct 2012

    Posted 23 Sep 2014 in reply to Stef Link to this post

    Thank you for your time, this was the problem.
Back to Top