Walkthrough Using ActiveX Viewer Control on the

The ActiveX Viewer Control allows you to view and print report output in a web browser. This walkthrough is split up into the following activities:

• Adding an ActiveReport to an ASP.NET Web application

• Connecting the report to a data source

• Adding controls to the report to contain data

• Adding the ActiveX viewer .cab file to the project folder

• Adding a ReportOutput folder to the project folder

• Adding required Object tags to the html code for the Web Form

• Adding code for the window_onload event for the Web Form

• Adding code to the Web Form's Page_Load event

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 program menu from your Windows Start button.

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

Product Nsme

Lhits In Stock

Lhits OH Order

Uhit Price

Chartreuse verte

eg

0

$18.00

Chang

17

40

$19.00

Guai ana Fantastica

a:

0

$450

Sasquatch Ale

111

0

$14.00

Sieeleye Stout

30

■0

$18.00

Chai

39

0'

$13.00

Cote de Blsye

17

0

$263.80

Ip oh Coffee

17

10

$4tîCiO

Laughing Lumberjack Lsger

32

■0

$14.00

Cutback Lager

15

10

$15.00

Rhcnbrau Kloiterbier

125

0

$7.75

Lakkalikoiri

57

0

Genen Shouyu

M orfrnnjo ods Cranberry Sauce

Original Frankfurter ^rulie

So tie

Grandmas Ooysenberry Spread

Gula Malacca

Chef Antonls Gumbo Mix

ChefAntonis Caiun Seasoning

Aniseeci Syrup

Uhits In Stock

Uhits Oh Order Uhit Price 0

$15.50 CIO

Adding an ActiveReport to an ASP.NET Web application 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 rptActiveX.

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. Click on Build...

Select Microsoft Jet 4.0 OLE DB Provider and click Next >>.

Click on the ellipsis to browse for the access path to NWind.mdb. Click Open once you have selected the appropriate access path.

Click OK to continue.

In the Query field, type "Select * from products order by categorylD". 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 rptActiveX.

2. Make the following changes to the group header:

o Change the name to ghCategories o Change the DataField property to CategorylD

3. Add the following controls to the GroupHeader section:

Control

Label Label Label Label

Name lblProductName lblUnitsInStock lblUnitsOnOrder lblUnitPrice

Text/Caption

Product Name Units In Stock Units On Order Unit Price

Location

4. Add the following controls to the Detail section:

Control DataField Name Text/Caption Location Output Format

TextBox ProductName txtProductName Product Name 0, 0 (Empty string) TextBoxUnitslnStock txtUnitsInStock Units In Stock 1.875, 0 (Empty string)

TextBox UnitsOnOrder txtUnitsOnOrder Units On

Order

TextBox UnitPrice txtUnitPrice Unit Price

2.9375, (Empty string) 0

4, 0 Currency

0 0

Post a comment