Telerik Reporting Table rows are not rendering

2 posts, 0 answers
  1. Oguzhan
    Oguzhan avatar
    2 posts
    Member since:
    Dec 2013

    Posted 30 Sep 2014 Link to this post

    Hello,

    I am trying to create Telerik reporting table programmatically , facing an issue with Telerik.reporting.table where my datatable rows are not getting rendered. Report is showing up only columns not rows. For more info, please find attached images for datatable and Telerik.reporting.table.

    Here is code snippet my using

    public Table DataGrid()
            {
                Table table = new Table();
     
                // Get data and bind it to the table
                System.Data.DataTable data = ChartsData.chartTable();
                 
                // Clear table before binding
                table.ColumnGroups.Clear();
                table.Body.Columns.Clear();
                table.Body.Rows.Clear();
     
                table.DataSource = data;
     
                int colCount = data.Columns.Count;
     
                for (int i = 0; i <= colCount - 1; i++)
                {
                    TableGroup tableGroupColumn = new TableGroup();
                    table.ColumnGroups.Add(tableGroupColumn);
                     
                    //table.Body.Columns.Add(new TableBodyColumn(Unit.Inch(0.01)));
     
                    HtmlTextBox txtGroup = new HtmlTextBox()
                    {
                        Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3)),
                        Value = data.Columns[i].ColumnName,
                        Style =
                        {
                            BorderStyle = { Default = BorderType.Solid },
                            BorderColor = { Default = System.Drawing.Color.Black },
                            Font = { Name = "Arial", Size = new Unit(10) },
                            VerticalAlign = VerticalAlign.Middle
                        },
                    };
                    tableGroupColumn.ReportItem = txtGroup;
     
                    HtmlTextBox txtTable = new HtmlTextBox()
                    {
                        Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3)),
                        Value = "=Fields." + data.Columns[i].ColumnName,
                        Style =
                        {
                            BorderStyle = { Default = BorderType.Solid },
                            BorderColor = { Default = System.Drawing.Color.Black },
                            BorderWidth = { Default = new Unit(0.5, UnitType.Point) }
                        }
                    };
                     
                    table.Body.SetCellContent(0, i,txtTable);
                    table.Items.AddRange(new ReportItemBase[] { txtTable, txtGroup });
                }
     
                return table;
            }

    Please advise how to resolve this issue? 
  2. Nasko
    Admin
    Nasko avatar
    1049 posts

    Posted 03 Oct 2014 Link to this post

    Hello Oguzhan,

    The Table item does not display any detail data rows because the table definition is missing a detail row group. For more information on this topic, please refer to the Table Basic Concepts help article.

    Our suggestion in this scenario and when creating a Table item programmatically is to create the desired Table item in the Visual Studio Report Designer first. After you are done with the desired Table layout and configuration during design time you can open the report's .Designer.cs file and use the automatically generated code there, as a template for dynamic Table generation. In this undertaking you may also find useful the Reporting API Reference.

    Regards,
    Nasko
    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.

     
Back to Top