Glossary Item Box

Walkthrough: Web Viewer Control | Samples | Walkthroughs | OutputFormat Strings | GroupKeepTogether enumeration

Tasks: Visual Studio.NET 2005 Web Changes

See Also ActiveReports for .NET 2 Online Help Send feedback to Data Dynamics

Walkthrough: HTTP Handlers

ActiveReports provides HTTPHandler components that, upon configuration, allow ASP.NET to automatically process reports that have been placed into an ASP.NET web site folder. ActiveReports HTTPHandler components enable reports to be easily deployed in both HTML and PDF. ActiveReports includes a simple configuration utility to properly register the HTTPHandler components with IIS and ASP.NET.

This walkthrough illustrates how to create a simple Web application and set the HTTPHandler to output report information in PDF format.

This walkthrough is split up into the following activities:

To complete the walkthrough, you must have access to the NorthWind database (NWind.mdb). You must also have access to Internet Information Services either from your computer or from the server. You must also run the "Configure Web Sample" option from the Data Dynamics ActiveReports for .NET 2.0 program menu from your Windows Start button.

When you have completed this walkthrough, you will have a report that looks similar to the following.

   

Adding an ActiveReport to an ASP.NET Web application

Important: If you are using Visual Studio.NET 2005, please see the Visual Studio.NET 2005 Web Changes topic.

To add an ActiveReport to your project

  1. Open a new ASP.NET Web application in Visual Studio.
  2. Click on Project > Add New Item.
  3. Select ActiveReports file and rename the file rptHTTPHandlers.
  4. Click Open.

Connecting the report to a data source

To connect the report to a data source

  1. Click on the yellow report DataSource icon in the Detail section. This brings up the report DataSource dialog box.
  2. Click on Build...
  3. Select Microsoft Jet 4.0 OLE DB Provider and click Next >>
  4. Click on the ellipsis to browse for the access path to NWind.mdb. Click Open once you have selected the appropriate access path.
  5. Click OK to continue.
  6. In the Query field, type "Select * from products ORDER BY categoryID, productname".
  7. Click OK to return to the report design surface.

Adding controls to the report to contain data

To add controls to the report

  1. Add a GroupHeader/Footer section to rptHTTPHandlers.
  2. Make the following changes to the group header:
    • Change the name to ghProducts
    • Change the DataField property to CategoryID
    • Change the GroupKeepTogether property to First Detail
    • Change the KeepTogether property to True
  3. Add the following controls to the GroupHeader section:

    Control Name Text/Caption Location
    Label lblProductName Product Name 0, 0
    Label lblQuantityPerUnit Quantity Per Unit 1.1875, 0
    Label lblInStock In Stock 2.5625, 0
    Label lblUnitPrice Unit Price 4, 0

  4. Add the following controls to the Detail section:

    Control DataField Name Text/Caption Location OutputFormat
    TextBox ProductName txtProductName Product Name 0, 0 (Empty string)
    TextBox QuantityPerUnit txtQuantityPerUnit Quantity Per Unit 1.1875, 0 (Empty string)
    TextBox UnitsInStock txtInStock Units In Stock 2.5625, 0 (Empty string)
     
    TextBox UnitPrice txtUnitPrice Unit Price 4, 0 Currency

Adding code to the Web.config file to enable HTTPHandler

To add code to the Web.config file

  1. Double-click the Web.config file in the Solution Explorer window.
  2. In the XML view, add the following code between the system.web tags. (Each handler must be on one line, so remove line breaks when pasting this code.)
        <httpHandlers>
        	<!--
        	********** ActiveReports HttpHandler Configuration **********
        	-->
        	<add verb="*" path="*.rpx" 
        	type="DataDynamics.ActiveReports.Web.Handlers.RpxHandler, ActiveReports.Web,
        	Version=4.0.0.1052, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
        	<add verb="*" path="*.ActiveReport" 
        	type="DataDynamics.ActiveReports.Web.Handlers.CompiledReportHandler,
        	ActiveReports.Web, Version=4.0.0.1052, Culture=neutral, 
        	PublicKeyToken=cc4967777c49a3ff" />
        	<add verb="*" path="*.ArCacheItem" 
        	type="DataDynamics.ActiveReports.Web.Handlers.WebCacheAccessHandler,
        	ActiveReports.Web, Version=4.0.0.1052, Culture=neutral, 
        	PublicKeyToken=cc4967777c49a3ff" />
        </httpHandlers>	
Note   The version number and PublicKeyToken will need to be updated to reflect the information for the current version of ActiveReports installed on your computer.

Adding a link to the Web Form

To add a link to the Web Form

  1. In the HTML view of the Web Form, add the following HTML code.
    <a href="rptHTTPHandlers.rpx?OutputFormat=pdf">WebApp.rpx OutputFormat=pdf</a>	
  2. Press F5 to run the program.
  3. Click the link on the web form to convert the report preview to PDF.

Walkthrough: Web Viewer Control | Samples | Walkthroughs | OutputFormat Strings | GroupKeepTogether enumeration

Tasks: Visual Studio.NET 2005 Web Changes

 

 


Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.