Telerik blogs
banner
Learn how to effortlessly integrate Telerik Reporting in your desktop or web application using the Visual Studio Item templates.

Are you developing a great application with both a desktop and web version, or migrating your Silverlight app to a more recent platform? If you're wondering how much time and effort it will take to make your reports work in these scenarios, we have good news for you—it’s next to nothing!

One of the advantages that makes Telerik Reporting stand out is its versatility, and specifically its ability to work with variety of technologies. It covers the well-established WebForms, WinForms and WPF platforms as well as modern web paradigms like MVC and Angular 2+. Migrating between these technologies is also a no-hassle process, since Telerik Reporting provides the tools and templates that will do the heavy-lifting for you.

As explained in a previous blog post, reusability is a substantial feature of our product—you create the reports once, using a report designer of your choice, store them in a class library, file storage or a database and then just load them in a report viewer. But configuring a report viewer may also take time, so we went a step further and decided to automate the process of adding a new report viewer to your project, regardless of the selected platform. We used Item templates—the Visual Studio’s common interface for adding and configuring a new item to a project through a wizard.

Item Template Wizards

The item templates that add a new report viewer come in two flavors, for both C# and VB developers. The templates share the same consistent look, but, depending on the selected project type, provide different configuration options and output files.

Initially the user has to select the reporting engine among three options: embedded, REST service or Report server. The “Embedded” option is only available for WinForms and WPF projects, because in these cases the reporting engine works locally—the report processing and rendering are performed by the same application. “REST service” and “Report server” options suggest that the viewer obtains its contents by an external service that can be hosted on another physical machine.

Image template page showing the Configure Reporting Engine dialog

On the next pages, the user is required to configure the report source, providing additional information related with the engine selection. Depending on the selected options, the wizard can traverse the solution structure, looking for report classes, or connect to a Telerik Report Server instance to obtain the list of categories and reports that can be displayed by the new viewer. The wizard can also add a new report or create a new report library project that contains a sample report definition.

Item template page showing Configure Report Source dialog

After pressing Finish, the wizard has gathered all the necessary information to successfully create and add the new item to the project. Depending on the selected options, a new report library can be added to the solution or a sample report can be included in an existing library. If needed, the wizard can download and install NuGet packages that are required to connect the viewer to a REST service or Report Server. The wizard maintains a detailed log for all the events that occurred during the process and displays it when finished.

When the wizard completes its work successfully, the initially selected project will be set up to work with Telerik Reporting and will have a report viewer, ready to display a report as previously configured. The report viewer can be hosted in a new form, window, cshtml view or an HTML/aspx page, depending on the project type.

HTML5-Based Item Templates

Item template page showing MVC report viewer setup dialog

The group contains three types of item templates—HTML5 Report Viewer Page, MVC Report Viewer View and WebForms Report Viewer Form, covering the most popular scenarios for presenting reports in a web application. Since the MVC Report Viewer and HTML5 WebForms Report Viewer are actually wrappers around the HTML5 Report Viewer, their item template wizards are similar, but in contrast of WPF and WinForms item templates, they lack the “Embedded” option when selecting the reporting engine. The wizard will automatically add and/or modify the required classes like ReportsController and Global.asax. Finally, the wizard will add a new HTML/aspx page or a cshtml view to the project, leaving to you to decide how and when to display them.

WinForms and WPF Item Templates

Image templates dialog showing WinForms and WPF item templates

The item template wizards for the so-called “desktop viewers” have the same configuration options, but the former produces a new System.Windows.Forms instance, and the latter a new System.Windows.Window, where the report viewer control is hosted. If the report viewer connects to a REST service or Report Server instance, the wizard will automatically add the NuGet packages to the project or configure them, if they already exist. The project’s startup form or window will not be changed, so the newly added item can be instantiated and shown when needed.

Angular

In case of Angular we provide a ready to use package, hosted on the npmjs.com public repository. The package can be included in your project with just one npm command. The report viewer is compatible both with Angular CLI and SystemJS projects, and to further ease the setup, we provide typescript definitions.

ASP.NET Core

We are no stranger to ASP.NET Core too. The HTML5 Report Viewer works flawlessly within ASP.NET Core 1.0+ (including 2.0). To simplify the setup the required Telerik Reporting REST Service can be not only hosted in MVC 4 and 5 applications, but with the provided NuGet packages you can host the REST Service with your ASP.NET Core .NET Framework enabled project.

Troubleshooting

Regardless of how carefully the item templates are designed and implemented, sometimes errors occur—and it’s crucial to provide detailed information about the problem and how to eliminate it. As mentioned above, the item template wizard displays a summary upon completion, which can be thoroughly examined to find the exact cause of the received error. The log itself is an HTML page that is saved in the selected project’s folder and can be reviewed later.

It’s Easy—Give It a Try

In this blog I explained how easy it is to add and set up a new report viewer to an existing application, regardless of the target platform, using the item template wizards in Visual Studio. The variety of options ensures that effectively no code is needed to display your reports and the detailed log information helps to quickly troubleshoot any error that might occur.

If you are curious see how Telerik Reporting can save you time and effort, start a free trial of Reporting and Report Server today.

Get Reporting in Our Bundles

You can get Telerik Reporting as an individual product or as a part of our bundles. We bring the best of Telerik and Kendo UI together in convenient bundles, including a wide-range of UI, reporting and productivity tools for both .NET and JavaScript technologies and support that’s got your back in every step of your project. Thanks to our intuitive APIs, alongside thousands of demos with source code availability, comprehensive documentation and a full assortment of VS templates you will get up and running with our tools in no time and fully embrace your inner warrior (Kendoka/Ninja).

By leveraging the broad array of themes, skins, styling and customization options, your application will awe even the best front-end designers. Check it out!


ivan-hristov
About the Author

Ivan Hristov

Ivan Hristov has been a software developer in the Telerik Reporting division since 2013. 

When not at work, he might be seen biking/skiing with his daughter, reading or discussing influential movies with friends. Feel free to reach out to him through LinkedIn.

Related Posts

Comments

Comments are disabled in preview mode.