Example T362490
Visible to All Users

Dashboard for Web Forms - How to Switch between Designer and Viewer Modes

This example shows how to switch between the Web Dashboard's working modes on the client-side.

Files to Look At

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

Dashboard_WebDashboard_2010/WebForm1.aspx
ASPx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Dashboard_WebDashboard_2010.WebForm1" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> html, body, form { height: 100%; margin: 0; padding: 0; overflow: hidden; } </style> <script src="Scripts/custom-script.js"></script> </head> <body> <form id="form1" runat="server"> <dx:ASPxButton ID="ASPxButton1" runat="server" Text="Switch to Viewer" ClientInstanceName="button" AutoPostBack="False"> <ClientSideEvents Click="switchMode" /> </dx:ASPxButton> <dx:ASPxDashboard ID="ASPxDashboard1" runat="server" Height="95%" ClientInstanceName="webDashboard" OnConfigureDataConnection="ASPxDashboard1_ConfigureDataConnection"> </dx:ASPxDashboard> </form> </body> </html>
Dashboard_WebDashboard_2010/Scripts/custom-script.js
JavaScript
function switchMode(sender) { var control = webDashboard.GetDashboardControl(); if (control.isDesignMode()) { control.switchToViewer(); button.SetText('Switch to Designer'); } else { control.switchToDesigner(); button.SetText('Switch to Viewer'); } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.