combit List & Label 24 - .NET Online Web Help
Use of the Ad-hoc Designer
Programming Introduction > Examples > Web Reporting > Use of the Ad-hoc Designer

 

Tip

The following section describes the concepts of the Ad-hoc Designer as well as the necessary steps for its implementation and tips & tricks.

For a complete implementation and use of the Ad-hoc Designer, see the sample project "C# Ad-hoc Designer Sample", which comes with ASP. NET samples. Further details can also be found in the two assemblies combit.ListLabel24.AdhocDesign und combit.ListLabel24.AdhocDesign.Web.

 

 Concepts

The Ad-hoc Designer is not a replacement for the Web Designer

It is a completely browser-based application (HTML+Javascript) that allows you to design basic reports like simple tables or charts very quickly. It offers only the most important features of the full List & Label Designer, but does not require an installation on the client computer like the Web Designer (see also Use of the Web Designer) does. Furthermore it provides a simplified user interface that can be used on any modern device, operating system and browser.

 

The projects of the Ad-hoc Designer are saved in a special file format

A project file that has been designed with the Ad-hoc Designer can be used like a regular List & Label project for exporting or printing it. You can also open it in the classic Designer to customize the more advanced properties, however a project that has been created or modified with the classic Designer cannot be loaded in the Ad-hoc Designer.

 

There is an Ad-hoc Designer session for every instance of the Ad-hoc Designer

Every time a user opens the Ad-hoc Designer in the browser, an IAdhocDesignerSession object on the server is created that manages this certain instance of the Designer. This session object loads the project if the Designer on the client needs it and stores the project when the client sends a project file to the server to save it. So usually for every browser tab that has the Ad-hoc Designer loaded, there is one Ad-hoc Designer session on the server which exists until the designer on the client is closed.

Integrating the Ad-hoc Designer into your application means connecting that session to the rest of your application to handle operations like loading and saving the project or creating the data source.

 

The Ad-hoc Designer is an application within your application

It is based on the ASP.NET MVC framework, but has it's own routes and controllers that you don't need to take care of. Please note that it is not a component that you can embed on your page (or view). The Ad-hoc Designer is opened by navigating (redirecting) to a special URL, so it always uses the whole page. If you would like to show it as part of an other page, you need to load it in an iframe.

 

 How to Add it to Your Application (in 3 Steps)

Step 1: Add the required dependencies

To integrate the Ad-hoc Designer in your ASP.NET project you first need to add the following NuGet packages:

And then reference the following assemblies of List & Label:

The RazorGenerator.Mvc package adds a RazorGeneratorMvcStart.cs file to your project. Please delete this file.

 

Step 2: Do some configuration

The Ad-hoc Designer is based on ASP.NET MVC. When your application is starting, you need to set up the routing and some other configuration of the Ad-hoc Designer:

 

Step 3: Open the Ad-hoc Designer

As mentioned above, there is one IAdhocDesignerSession object on the server for each active Ad-hoc Designer on a client. Before the Ad-hoc Designer can be opened on the client, you need to create a new object of the IAdhocDesignerSession interface.

We recommend to use one of the included Ad-hoc-Session types that handle the load & save operations for you:

Finally you call this.RedirectToAdhocDesigner(session) in an action of your MVC controller to redirect the request to a new Ad-hoc Designer (import the combit.ListLabel24.AdhocDesign.Web namespace to make this extension method available). You can find an example of this in the supplied ASP. NET sample project "C# Ad-hoc Designer" underHomeController.OpenNewProject().

 

 Tips & Tricks

If you need more control when creating, loading or saving a project

Create your own Ad-hoc Designer session type and let it inherit from AdhocDesignerSessionBase. Many methods are virtual and may be overriden, e.g. when you want to customize the defaults for a new project.

 

If you need more control over the lifetimes and management of the Ad-hoc Designer sessions

Create your own implementation of the IAdhocDesignerSessionManager interface and pass it to the AdhocDesignerWeb.Setup(...) method (see Step 2).