Designer and Viewer Modes in ASP.NET Core
- 2 minutes to read
The Web Dashboard can function as a designer or viewer. The following modes are available:
- Designer
- The Web Dashboard works as a designer and allows users to create, edit, and save dashboards. In this mode, the control loads the extensions required to design dashboards. Users can access the Data Source Wizard and can preview underlying data. A user can switch the control to
Viewer
mode and can modify dashboards from storage on the client side. Requests from the dashboard backend server can be sent to third-party resources. This is the default mode. - Viewer
- The Web Dashboard works as a viewer and displays dashboards to users. In this mode, the control also loads the extensions required to design dashboards. A user can switch the control to
Designer
mode. - ViewerOnly
- The Web Dashboard does not load extensions required to design dashboards. Users cannot switch to
Designer
orViewer
modes on the client.
Note
The Model API is not effective when the Web Dashboard operates in Viewer
or ViewerOnly
modes.
Specify Designer or Viewer Mode on the Server
You can use the DashboardBuilder.WorkingMode property to specify the mode on the server when you configure the Web Dashboard.
In Viewer mode, you have access to the client API and can modify dashboards from storage. The clientAPI also allows you to switch between Viewer and Designer modes. For information on how to protect dashboards stored on a server, see the following topic: Security Considerations.
<div style="position: absolute; left:0;top:0;right:0;bottom:0;">
@(Html.DevExpress().Dashboard("clientDashboardControl")
.ControllerName("DefaultDashboard")
.Width("100%")
.Height("100%")
.WorkingMode(WorkingMode.ViewerOnly)
)
</div>
Switch Between Designer or Viewer Modes on the Client
You can use the DashboardControl.switchToViewer and DashboardControl.switchToDesigner methods to switch between modes on the client.
Use the DashboardControl.isDesignMode method to indicate whether the Web Dashboard works in Designer mode.
This example shows how to switch between the Web Dashboard’s working modes on the client-side if you handle the onclick
event of the added button.
@page
<div style="left:0;top:0;">
<input type="button" id="button1" value="Switch to Viewer" onclick="switchMode()" />
</div>
<div style="position: absolute; left:0;top:30px;right:0;bottom:0;">
@(Html.DevExpress().Dashboard("clientDashboardControl")
.ControllerName("DefaultDashboard")
.Width("100%")
.Height("100%")
.WorkingMode(WorkingMode.Designer)
)
</div>
Switch Between Designer or Viewer Modes in the UI
You can enable the Dashboard Panel to allow users to switch between the Designer
and Viewer
.