FastReport .NET 2013.2 MVC

2013-03-11

We have released FastReport .NET 2013.2 with MVC support. And I'd like to inform all WebReport developers about some changes.

First. An extension of the handler in web.config was changed. You need replace old string «FastReport.Export.aspx» to new string «FastReport.Export.axd» everywere. Web application without these changes will throw an exception and you will see text with error and instructions for changes in web.report.

You can check the handler of WebReport by typing in the address bar: http://site_address/app_folder/ FastReport.Export.axd (replace site_address and app_folder with your values).

In the successfull request case you'll see FastReport version number and server time.

Second. We have added support of ASP.NET MVC framework. You will not have any troubles with using our control in ASPX (MVC 2) – You'll just enough drag control from Toolbox to the page. WebReport will set all needed changes in web.config automatically. Let see the demo of WebReport in aspx in folder \Demos\C#\MvcDemo.

Also I should say how to use the WebReport in Razor (MVC 3,4).  You will need add lines with handler defenitions in web.config in root folder of your web-application.  Add line in section <system.webServer> <handlers> for using in IIS7:
<add name="FastReportHandler" path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" />

Add line in section <system.web> <httpHandlers> for using in IIS6:
<add path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" />

Then you should modify web.config in folder with Views.  Add lines in section <system.web.webPages.razor> <namespaces>:
<add namespace="FastReport" />
<add namespace="FastReport.Web" />

Add lines in file _Layout.cshtml in tag <head>:
@WebReportGlobals.Scripts()
@WebReportGlobals.Styles()

Now you can draw the report on the View. Go to the controller and create a WebReport:
WebReport webReport = new WebReport(); // create object
webReport.Width = 600;  // set width
webReport.Height = 800; // set height
webReport.Report.RegisterData(dataSet, "AppData"); // data binding
webReport.ReportFile = this.Server.MapPath("~/App_Data/report.frx");  // load the report from the file
ViewBag.WebReport = webReport; // send object to the View

Go to View and add the line:
@ViewBag.WebReport.GetHtml()

Similar code to create WebReport you can also write directly in View.

Let see the demo of WebReport in Razor in folder \Demos\C#\MvcRazor. There are various samples for load the report, including preprepared, and there is an example of using event StartReport.

Do not forget to add the missing dll in bin directory.

.NET .NET FastReport FastReport MVC MVC
November 26, 2024

Installing FastReport on .NET 8.0 and Creating a Simple Report

The purpose of this article is to explain step by step how to install FastReport on .NET 8.0 and how to create a simple report. Taking the reporting process from the beginning, it will show how to connect, design and view reports.
November 20, 2024

Localization and Language Switching in FastReport VCL

FastReport VCL supports 40 languages for interface localization and allows you to change the language on the fly through menus or code, without recompilation.
November 01, 2024

New Features of the FastReport VCL Editor

We are considering new features of the report editor: extension lines, highlighting of intersecting objects, updated report and data trees.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2025 Fast Reports Inc.