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

Telerik Reporting Table rows are not rendering

1 Answer 415 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Oguzhan
Top achievements
Rank 1
Oguzhan asked on 01 Oct 2014, 04:22 AM
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? 

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 03 Oct 2014, 01:42 PM
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.

 
Tags
General Discussions
Asked by
Oguzhan
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or