Working with the Telerik Report Server API in ASP.NET MVC

Working with the Telerik Report Server API in ASP.NET MVC

Learn how to use the Telerik Report Server API to enhance the functionality of your applications by giving the user a list of reports they can view.

Learn how to use the Telerik Report Server API to enhance the functionality of your applications by giving the user a list of reports they can view.

The Telerik Report Server is, obviously, a repository for the reports that you display in your applications. However, it also includes a rich API that lets you take advantage of that repository to incorporate additional functionality into your applications. You can, for example, give users a list of all the reports they’re allowed to view and then display their selected report. It’s not as easy as you might like, but it will save you from having to create a dedicated View for every report in your ASP.NET MVC application.

To implement this plan, you’ll probably need want to use two Views because the ReportViewer does tend to take over your whole page: One View to display the dropdown list of reports and another View to display the actual report. I’ll start by constructing the View with the dropdown list of reports.

Setting Up to Call the Report Server API

To give the user a list of reports, you first need to retrieve that list from the Telerik Report Server. While you could use the standard .NET HttpClient object and craft your own RESTful requests to the server, Telerik Report Server provides a dedicated client (ReportServerClient) that makes it much easier to work with the server’s API.

To use the Telerik client, you’ll need to add references to Telerik.ReportServer.HttpClient.dll and Telerik.ReportServer.Services.Models.dll. Those are installed with the Telerik Report Server and can be found in the Tools folder of the Report Server’s installation folder (on my computer I found them in C:\Program Files (x86)\Progress\Telerik Report Server\Tools). You’ll also need the NuGet packages for Microsoft.AspNet.WebApi.Client and Newtonsoft.Json.

The next obvious step is to retrieve a set of ReportInfo objects from the server using the client. However, this is where you’ll run into a problem. The ReportInfo object has a number of properties, including the report file’s name (in the Name property), the report file’s extension (Extension property), and the Id of the category that the report belongs to (CategoryId). To use the report with Telerik’s ReportViewer, however, you need to pass the ReportViewer the report’s Uri, consisting of the report’s category name, file name, and file extension. This means that you need assemble the Uri from the ReportInfo’s properties.

asp.net

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

jQuery Ajax CRUD in ASP.NET Core MVC with Modal Popup

In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.

Hire ASP.Net Developers

Looking to outsource your asp dot net development requirement? ASP.Net is a special feature of the DOT Net framework created by Microsoft. At [HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io"), we have a team of experienced...

MVC User Registration & Login with ASP.NET Core Identity

In this article, we will discuss the quickest way to use ASP.NET Core Identity for User Login and Registration in a new or existing MVC application.

Running WordPress on ASP.NET Core with Peachpie

In this article, you will learn how to use or integrate WordPress in ASP.NET and Running WordPress on ASP.NET Core, without PHP, or any source files on the server. The following demonstration will show you how to add WordPress as a frontend to an existing ASP.NET Core application step by step.

Routing in MVC - ASP.NET Core Demystified

ASP.NET Core MVC has introduced quite a few concepts that new (or new-to-ASP.NET) web developers might have some difficulty getting caught up with. My ASP.NET Core Demystified series is designed to help these developers get started building their own custom, full-fledged, working AASP.NET Core applications. In