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

How create table with dynamic columns

1 Answer 564 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Marcelo
Top achievements
Rank 1
Marcelo asked on 19 Nov 2013, 10:02 AM
Hi all,

I want design a report with a table,  but the number of columns is dynamic. How I can do it?  I receive data from a Stored Procedure.
If you can, please send an example.

Best Regarsd,
Marcelo Videira

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 20 Nov 2013, 05:04 PM
Hi Marcelo,

The best approach is to start by creating a sample Table item using the provided reporting designer and Table Wizard. Then get the code generated by the designer in the report's designer.cs(vb) file. This will help you get more familiar with the Table item structure and create code generating Table item based on provided data schema (number of columns and column names).

As it is not recommended to modify the report definition once the processing has started, add the dynamically created Table item to the report instance Items collection, before displaying the report:
var report = new MyReport();
var myTable = GenerateTableItem();
report.Items.Find("detail", true)[0].Items.Add(myTable);
 
reportViewer1.ReportSource = new InstanceReportSource{ ReportDocument = report };

I hope this information helps you.

Regards,
Stef
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

Tags
Report Designer (standalone)
Asked by
Marcelo
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or