Glossary Item Box

Samples: Visual Studio 2005 Web Sample

Reference: What's New

Troubleshooting: Visual Studio 2005 Web Project Conversion

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

Visual Studio.NET 2005 Web Changes

Due to the new web features in Visual Studio.NET 2005, different methods are recommended for using ActiveReports in web projects.

Note: There are several known issues with Visual Studio.NET 2005.

Creating a New Visual Studio 2005 Web Project with ActiveReports

To create a new Visual Studio 2005 Web project with ActiveReports

  1. In Visual Studio 2005, create a New Web Site.
  2. In the Solution Explorer, right-click the solution and choose Add New Project.
  3. Select a project type of Visual Basic or C# and choose the Class Library template.
  4. Name the new class library ReportAssembly and click OK.
  5. Delete Class1 from the ReportAssembly.
  6. In the Solution Explorer, right-click the ReportAssembly class, and choose Add... < New Item...
  7. In the Add New Item dialog, select ActiveReports File.
  8. Name the report rptMyReport, and click the Add button.
  9. Add controls and data to the report as desired. (See Getting Started to learn to create a simple report.)
  10. In the Solution Explorer, right-click the Web project, and choose Add Reference...
  11. In the Add Reference dialog, on the Projects tab, select the ReportAssembly class library and click OK.
  12. Drag a WebViewer onto Default.aspx and size it as desired.
    Note: In Visual Studio 2005, you do not need to set up the HttpHandlers unless you are using IIS. HttpHandlers must be set up only in Visual Studio 2003 projects.
  13. In the Properties grid, type ReportAssembly.rptMyReport into the ReportName property.
    Note: Reports in the ReportAssembly will not appear in the WebViewer's combobox because they are not in the same project.
  14. Run the project to view the results.

Converting Visual Studio 2003 Web Projects that Contain
ActiveReports to Visual Studio 2005 Web Projects

To convert an ActiveReports Web project

  1. Open an existing Visual Studio 2003 Web project in Visual Studio 2003.
  2. In the Solution Explorer, right-click the solution and choose Add < New Project.
  3. Select a project type of Visual Basic or C# and choose the Class Library template.
  4. Name the new class library ReportAssembly and click OK.
  5. Delete Class1 from the ReportAssembly.
  6. Move any existing reports from your website project into the ReportAssembly class library by using the following steps:
    1. In Windows Explorer, move the *.rpx files to the ReportAssembly class library directory.
    2. In the Solution Explorer, right-click the ReportAssembly class and choose Add < Add Existing Item...
    3. In the Add Existing Item dialog, navigate to the ReportAssembly class library directory and select the existing *.rpx files and click OK to add them to the solution. ActiveReports automatically creates a cod-behind file (*.cs or *.vb) for each *.rpx.
    4. Manually update the code-behind files (*.vb or *.cs) to import any existing report code from your Visual Studio 2003 Web project.
  7. In the Solution Explorer, right-click the Web project, and choose Add Reference...
  8. In the Add Reference dialog, on the Projects tab, double-click the ReportAssembly class and click OK.
  9. Right-click each *.rpx file and select Open with..., then choose the XML Editor.
  10. Ensure that the CodeFile attribute in each *.rpx matches the actual code file.
  11. Save and close the solution.
  12. Open the solution in Visual Studio 2005.
  13. When prompted by the Conversion Wizard, convert the project to a Visual Studio 2005 Project.

Alternate Method (Not Recommended)

To convert an ActiveReports Web project

  1. Open a VS 2003 Web project in VS 2005.
    Note: Open the *.csproj or *.vbproj file rather than the *.sln file or the project file will unload.
  2. When prompted by the Conversion Wizard, convert the project to a VS 2005 Project.
  3. Close Visual Studio, saving the project and *.sln file when prompted, and open the project folder in Windows Explorer.
  4. Move the rpx file for each report to the App_Code folder where the corresponding *.vb or *.cs file for each report resides.
  5. Rename the *.vb or *.cs files to *.rpx.vb or *.rpx.cs files.
  6. Open each *.rpx file in Notepad.
  7. Change the name of the CodeFile Attribute found on the second line of XML code from *.vb or *.cs to *.rpx.vb or *.rpx.cs to match the files renamed in step 5 above.
  8. Save and close each *.rpx file.
  9. Open the *.sln file (the proj file is gone) in VS 2005.
  10. Open the design view and the code view of each of the reports before running the project so that it will be able to find the reports in the new location.

Moving Reports Created in Visual Studio 2003 to a Visual Studio 2005 Project

To move an ActiveReport to a WinForms project

  1. Open the Visual Studio 2005 project to which you want to add reports.
  2. Ensure that the CodeFile attribute in each *.rpx file that you want to add matches the actual code file.
  3. In the Solution Explorer, right-click the project and choose Add < Add Existing Item...
  4. In the Add Existing Item dialog, navigate to the existing reports you want to add.
  5. Select the *.rpx and any associated *.cs or *.vb files and click OK.

Using Exports in Visual Studio 2005 Web Projects

Note: The export control icons do not appear in the toolbox in Web projects in Visual Studio 2005.

To use ActiveReports exports in Web projects

  1. In the Solution Explorer, right-click the solution and choose Add Reference.
  2. On the .NET tab, scroll down and select the Data Dynamics ActiveReports Export Filter of your choice and click OK.
  3. Add code like the following to the Page_Load event of the WebForm to export the report (to Excel format in this case).
    [Visual Basic]
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _
      MyBase.Load
        Dim rpt As New ActiveReport1
        rpt.Run()
        Dim x As New DataDynamics.ActiveReports.Export.Xls.XlsExport
        x.Export(rpt.Document, Server.MapPath("") + "\ReportOutput\x.xls")
    End Sub

     

    [C#]
    protected void Page_Load(object sender, EventArgs e)
    {
        ActiveReports1 rpt = new ActiveReports1(); 
        rpt.Run();
        DataDynamics.ActiveReports.Export.Xls.XlsExport x = new 
    	DataDynamics.ActiveReports.Export.Xls.XlsExport();
        x.Export(rpt.Document, Server.MapPath("") + "\\ReportOutput\\x.xls");
    }
  4. Right-click the ReportOutput folder, select Sharing and Security..., and give write permissions for this folder to the Users group.

Samples: Visual Studio 2005 Web Sample

Reference: What's New

Troubleshooting: Visual Studio 2005 Web Project Conversion

 

 


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