Hi Telerik,
I have an issue in regards to dynamic reports.
I am adding columns dynamically, but cell is being duplicated for all cells in content section, for each row.
This is my code:
private void table1_ItemDataBinding(object sender, EventArgs e)
{
// table is being populated from as WS
processingTable.DataSource = table;
//we do not clear the Rows collection, since we have a details row group and need to create columns only
this.table1.ColumnGroups.Clear();
this.table1.Body.Columns.Clear();
this.table1.Body.Rows.Clear();
int i = 0;
this.table1.ColumnHeadersPrintOnEveryPage = true;
// Properties are the object properties - they will represent the columns
foreach (PropertyInfo property in properties)
{
Telerik.Reporting.HtmlTextBox textboxGroup = null;
Telerik.Reporting.HtmlTextBox textBoxTable = null;
Telerik.Reporting.TableGroup tableGroupColumn = new Telerik.Reporting.TableGroup();
this.table1.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 = property.Name;
textboxGroup.Size = new SizeU(Unit.Inch(1.1+i), 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." + property.Name;
textBoxTable.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
this.table1.Body.SetCellContent(0, i++, textBoxTable,1,1);
this.table1.Items.AddRange(new ReportItemBase[] { textboxGroup, textBoxTable });
this.table1.ColumnGroups.Add(tableGroupColumn);
}
}
I am attaching the screenshot for it. Basically all contain the same value for all columns, it´s taking the first value I set in
this.table1.Body.SetCellContent(0, i++, textBoxTable,1,1);
but all fields are different for each column.
I am attaching an image with some sample data for one row (fields.png).
Please help.
Thanks,
I have an issue in regards to dynamic reports.
I am adding columns dynamically, but cell is being duplicated for all cells in content section, for each row.
This is my code:
private void table1_ItemDataBinding(object sender, EventArgs e)
{
// table is being populated from as WS
processingTable.DataSource = table;
//we do not clear the Rows collection, since we have a details row group and need to create columns only
this.table1.ColumnGroups.Clear();
this.table1.Body.Columns.Clear();
this.table1.Body.Rows.Clear();
int i = 0;
this.table1.ColumnHeadersPrintOnEveryPage = true;
// Properties are the object properties - they will represent the columns
foreach (PropertyInfo property in properties)
{
Telerik.Reporting.HtmlTextBox textboxGroup = null;
Telerik.Reporting.HtmlTextBox textBoxTable = null;
Telerik.Reporting.TableGroup tableGroupColumn = new Telerik.Reporting.TableGroup();
this.table1.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 = property.Name;
textboxGroup.Size = new SizeU(Unit.Inch(1.1+i), 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." + property.Name;
textBoxTable.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
this.table1.Body.SetCellContent(0, i++, textBoxTable,1,1);
this.table1.Items.AddRange(new ReportItemBase[] { textboxGroup, textBoxTable });
this.table1.ColumnGroups.Add(tableGroupColumn);
}
}
I am attaching the screenshot for it. Basically all contain the same value for all columns, it´s taking the first value I set in
this.table1.Body.SetCellContent(0, i++, textBoxTable,1,1);
but all fields are different for each column.
I am attaching an image with some sample data for one row (fields.png).
Please help.
Thanks,