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

dynamic vertical column grouping

1 Answer 69 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ameya
Top achievements
Rank 1
Ameya asked on 14 Jun 2017, 12:55 PM

we want to create a dynamic grid. the first column has to be vertical grouped for certain rows. when we add  the row group it throws this error

here is the code and stack trace

Telerik.Reporting.TableGroup tableGroupPremiumBsisChild = new Telerik.Reporting.TableGroup();

                                                tableGroupPremiumBsisChild.Groupings.Add(new Telerik.Reporting.Grouping(null));
                                                tableGroupPremiumBsisChild.Name = "detailTableGroup";

                                                Telerik.Reporting.TableGroup tableGroupPremiumBsis = new Telerik.Reporting.TableGroup();
                                                tableGroupPremiumBsis.ChildGroups.Add(tableGroupPremiumBsisChild);
                                                tableGroupPremiumBsis.Groupings.Add(new Telerik.Reporting.Grouping("=Fields.[" + recap.Columns[i].ColumnName.ToString() + "]"));
                                                tableGroupPremiumBsis.GroupKeepTogether = true;
                                                tableGroupPremiumBsis.Name = "exposureBasis";

                                                tableGroupPremiumBsis.ReportItem = textBoxTableRValue;
                                                tableGroupPremiumBsis.Sortings.Add(new Telerik.Reporting.Sorting("=Fields.[" + recap.Columns[i].ColumnName.ToString() + "]", Telerik.Reporting.SortDirection.Asc));

                                                //adding this line throws the object reference not set to an instance of the object
                                                recapTable.RowGroups.Add(tableGroupPremiumBsis);

                                                textBoxTableRValue.Angle = 270D;
                                                textBoxTableRValue.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.28124985098838806D), Telerik.Reporting.Drawing.Unit.Inch(0.30208322405815125D));
                                                textBoxTableRValue.Style.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(216)))), ((int)(((byte)(219)))), ((int)(((byte)(218)))));
                                                textBoxTableRValue.Style.BorderColor.Default = System.Drawing.Color.Gray;
                                                textBoxTableRValue.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
                                                textBoxTableRValue.Style.BorderWidth.Default = Telerik.Reporting.Drawing.Unit.Point(0.5D);
                                                textBoxTableRValue.Style.Color = System.Drawing.Color.Black;
                                                textBoxTableRValue.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(8D);
                                                textBoxTableRValue.Style.Font.Name = "Calibri";
                                                textBoxTableRValue.Style.LineColor = System.Drawing.Color.Gray;
                                                textBoxTableRValue.Style.LineWidth = Telerik.Reporting.Drawing.Unit.Point(0.5D);
                                                textBoxTableRValue.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
                                                textBoxTableRValue.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
                                                textBoxTableRValue.Value = "=Fields.[" + recap.Columns[i].ColumnName.ToString() + "]";
                                                textBoxTableRValue.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
                                                recapTable.Body.SetCellContent(0, i, textBoxTableRValue);

here is the stack trace...any idea what is going wrong? thanks for your help

System.NullReferenceException occurred
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at Telerik.Reporting.Processing.Table.ForEachCell(Action`1 action)
   at Telerik.Reporting.Processing.Table.MeasureDataItemContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.DataItem.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Panel.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.SubReport.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Paging.PhysicalPageLayout.PhysicalPageMeasurement.MeasureRoot(LayoutElement root, IMeasureContext measureContext, PageSettings pageSettings)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.MeasureRootCore(LayoutElement root, IMeasureContext measureContext, PageSettings pageSettings)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(LayoutElement root, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback, PageSettings pageSettings)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)
   at Telerik.Reporting.Processing.ReportProcessor.CountPages(IList`1 reports, IRenderingContext renderingContext, Hashtable deviceInfo, ExtensionInfo extensionInfo)
   at Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo)
   at Exl.Reporting.Audit.Classes.Render.<GenerateCarrierViewReport>d__4.MoveNext() in C:\ProjectsAS3Dev\Support Classes\Exl.Reporting.Audit\Classes\Render.cs:line 675

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 16 Jun 2017, 02:50 PM
Hi Ameya,

Our recommendation is to use the Visual Studio Report Designer, test data and to create a sample report representing the desired structure. Then you can get the auto-generated code from the report's Designer.cs|vb file and reuse it at run-time.
For more details and suggestions how to verify reports created at run-time, please check Modifying or Creating a report at Run-Time.

I hope this helps.

Regards,
Stef
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ameya
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or