Files to look at:
- CustomReportStorageWebExtension.cs (VB: CustomReportStorageWebExtension.vb)
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
- Designer.aspx (VB: Designer.aspx)
- Designer.aspx.cs (VB: Designer.aspx.vb)
- DesignerTask.cs (VB: DesignerTask.vb)
- Global.asax.cs (VB: Global.asax.vb)
How to integrate the Web Report Designer into a web application and Add, Edit, and Remove Reports from a Database storage
Overview
The example demonstrates how to integrate the End-User Report Designer into an ASP.NET WebForms application and implement a Microsoft SQL Server database report storage to add, edit and delete reports. This example also demonstrates how to add custom commands to the report designer menu at runtime. A custom Close menu command redirects you to the homepage.
Note The report storage implementation is for demonstration purposes only. Create your own implementation for use in production.
Before you start
- Create a Reports database in the local Microsoft SQL Server. Add the ReportLayout table with the following script:
SQL
USE [Reports]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportLayout](
[ReportId] [int] IDENTITY(1,1) NOT NULL,
[DisplayName] [nvarchar] NULL,
[LayoutData] [varbinary] NULL,
[ReportId] ASC
CONSTRAINT [PK_ReportLayout6] PRIMARY KEY CLUSTERED
(
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SQL Server 2016 - v13.0.x.x
USE [Reports]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportLayout](
[ReportId] [int] IDENTITY(1,1) NOT NULL ,
[DisplayName] [nvarchar](50) NULL,
[LayoutData] [varbinary](max) NULL,
CONSTRAINT PK_ReportLayout PRIMARY KEY (ReportId)
);
SELECT *
FROM [dbo].[ReportLayout]
ORDER BY [ReportId] ASC
GO
- Add the Northwind database to your local MS SQL server.