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

How to create a report and design it programatically from the code

1 Answer 189 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
phani Raja Sekhar
Top achievements
Rank 1
phani Raja Sekhar asked on 31 Dec 2009, 09:15 AM
Hi Telerik Team,

                 I have a portal which has the functionality to print the details displayed in the UI. I want to implement the same functionality of printing the data in the UI using the Telerik Reporting. I was able to implement the same by creating a report using the Report Wizard and then viewing the same using ReportViewer and then was able to print the data.

                   My question here is "How do i create a report on the fly through the code which includes the designing of the report based on the multiple parameters passed to the report and also display the data from a database?" . I have gone through the Self paced training material provided in the Telerik site but was not able to implement the same.

          My portal is already up and running and i just want to incorporate Telerik Reporting into the portal and implement the Reporting functionality and then print the report. The Report parameters will wary from page to page of the portal and the Report should be available across all the pages of the portal.
 
            Please provide me with some inputs on how to implement the same.

Thanks,
Raja Sekhar.

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 04 Jan 2010, 02:43 PM
Hi phani Raja Sekhar,

Creating reports entirely with code requires good understanding of the Report Life Cycle, Report Sections and Report Items.

As the Report Life Cycle topic explains the Telerik Reporting engine works with two object:

  • the report definition - a class derived from Telerik.Reporting.Report; usually created with the help of the Report Designer or programmatically. Its only purpose is to describe how the report will look like. You may think of the reports as data grids - when you put the data grid on a form, this is actually the description/template of the grid which defines how the data will be displayed, appearance and behavior. This is exactly what the report definition is for.
  • the report instance (an object type Telerik.Reporting.Processing.Report) is the report definition merged with the data from the data source.
Both objects look similar (and sometimes both are called "Reports", which is incorrect), but are not the same as you can tell from their namespaces.

Generally we "push" users to use our Report Designer for creating the reports, as it handles almost all possible scenarios you can think of. Of course one unsupported scenario is end user driven report creation where the user defines the report layout, data to be shown etc. and in such cases creating the report from scratch based on these user inputs is required. According to your description, the reports should reflect already existing pages in a portal, so creating the report through the designer is an option and preferred approach.

Anyway if you need to see how is something accomplish with code - the easiest way to see that is to go in the Report Designer, create what you need and then look at the code it has generated for you in the InitializeComponent() method. The designer generated code is the fastest way that you can get up to speed with the Report object hierarchy (including the Report help API of course).

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
phani Raja Sekhar
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or