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

Add table data programatically

1 Answer 324 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ben Foster
Top achievements
Rank 1
Ben Foster asked on 11 Feb 2010, 01:38 PM
Hi there,

I am currently learning to use Telerik reporting, and am stuck on something that should be simple, but I just can't figure it out !!

I have added a table to the designer view of my report.

In the "MyReport_NeedDataSource" method I simply want to add data to this table.

I don't want to bind the table to an SQL data source, I simply want to add the values programatically, row by row.

The table is already five columns wide, so I would like something like:

        table1.rows.add(new tablerow("value1", "value2", "value3", "value4", "value5");

        or even something like:

        table1.rows[0].cells[0] = "value1";
        table1.rows[0].cells[1] = "value2";
        table1.rows[0].cells[2] = "value3";
        table1.rows[0].cells[3] = "value4";
        table1.rows[0].cells[4] = "value5";

I'm sure there must be a way to do something like this. Please advise when able.

Kind regards, Ben.

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 12 Feb 2010, 10:17 AM
Hello Ben,

The Table/Crosstab report item is not a mere grid of cells and has a very complex internal structure. The Report Designer does a great deal of work to simplify common tasks, but the underlying code is far from trivial. The easiest way to see the internal table structure is to create a table in the designer with the hardcoded values you would like (see screenshot) and then go into the InitializeComponent() method to see the code behind it.

Best wishes,
Steve
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Ben Foster
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or