I am trying to build a dynamic report with many tables which have different columns definition.
My source is a list of data table
My code is:
public
EntregaReport()
{
InitializeComponent();
var list = Entrega.GetEntregaDocumentos(
"BERK_122"
);
HtmlTextBox textboxHeader;
HtmlTextBox textBox;
foreach
(DataTable dataTable
in
list)
{
Table table =
new
Table();
//SetTableProperties(ref table);
detail.Items.Add(table);
table.ColumnHeadersPrintOnEveryPage =
true
;
table.DataSource = dataTable;
Telerik.Reporting.HtmlTextBox textboxGroup;
Telerik.Reporting.HtmlTextBox textBoxTable;
table.ColumnGroups.Clear();
table.Body.Columns.Clear();
table.Body.Rows.Clear();
int
colCount = dataTable.Columns.Count;
for
(
int
i = 0; i <= colCount - 1; i++)
{
Telerik.Reporting.TableGroup tableGroupColumn =
new
Telerik.Reporting.TableGroup();
table.ColumnGroups.Add(tableGroupColumn);
table.Body.Columns.Add(
new
Telerik.Reporting.TableBodyColumn(Unit.Inch(1)));
textboxGroup =
new
Telerik.Reporting.HtmlTextBox();
textboxGroup.Style.BorderColor.Default = Color.Black;
textboxGroup.Style.BorderStyle.Default = BorderType.Solid;
textboxGroup.Value = dataTable.Columns[i].ColumnName;
textboxGroup.Size =
new
SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
tableGroupColumn.ReportItem = textboxGroup;
textBoxTable =
new
Telerik.Reporting.HtmlTextBox();
//textBoxTable.Style.BorderColor.Default = Color.Black;
//textBoxTable.Style.BorderStyle.Default = BorderType.Solid;
textBoxTable.Value =
"=Fields."
+ dataTable.Columns[i].ColumnName;
textBoxTable.Size =
new
SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
table.Body.SetCellContent(0, i, textBoxTable);
table.Items.AddRange(
new
ReportItemBase[] { textBoxTable, textboxGroup });
}
}
}
It´s seems the tables are created but the data is not bind, do I miss something.
Thanks Jochanan