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

Adding columns to a table at processing time

3 Answers 682 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Frédéric
Top achievements
Rank 1
Frédéric asked on 08 Apr 2009, 03:50 PM
Hi,

I have a table report item in the detail section.

For each detail row, the table is bound to a DataTable in the NeedDataSource event handler of the table.

The DataTable columns vary from one detail row to an other. Say, for the first detail row, the DataTable could have 2 columns and in  the second detail row, the DataTable could have 5 different columns.

I would like to add columns to the table at processing time (like inside the NeedDataSource event handler) in order to display the DataTable bound to the table.

Thanks a lot.

Frederic

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 09 Apr 2009, 02:06 PM
Hello Frédéric,

As we are not very sure what you're trying to achieve, please provide us with a screenshot/drawing of how your table should look like for a couple of detail records. Any additional information you can provide and consider helpful would be appreciated.

Regards,
Steve
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Frédéric
Top achievements
Rank 1
answered on 09 Apr 2009, 07:09 PM
Hello Steve,

To simplify things, I would like to know if it is possible to create a Table ReportItem programmatically, like other report items as documented here http://www.telerik.com/help/reporting/programmatic-creating-controls.html.

I am looking at the api and I can not figure how to programmatically add columns to a Table.

Thanks a lot.

Frédéric
0
Accepted
Steve
Telerik team
answered on 10 Apr 2009, 01:38 PM
Hello Frédéric,

I am afraid that this is a bit more complicated than simple matter of rows and columns. We encourage you to open the sample reports we ship with our installation, locate the ProductCatalog report and check the table item used there. It does look like a table right :) If you however check the InitializeComponent method you would notice that these are defined as ColumnGroups and RowGroups i.e.:
...
this.table1.ColumnGroups.Add(tableGroup7);
..
this.table1.RowGroups.Add(tableGroup8);
...

The body is defined with  this.table1.Body.SetCellContent() method where you specify the rowIndex, columnIndex and the report item in that cell.

You can find more information on those in the "Working with Table/CrossTab/List items" help section:

Greetings,
Steve
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Frédéric
Top achievements
Rank 1
Answers by
Steve
Telerik team
Frédéric
Top achievements
Rank 1
Share this question
or