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
Please advise how to resolve this issue?
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?