The requested page is not available for the requested platform. You are viewing the content for Default platform.

How to: Implement Save As and Delete Functionality for the ASP.NET MVC Dashboard Extension

This example demonstrates how to add the "Save As" and "Delete" menu items to the Web Dashboard control. This items allow you to save the current dashboard with a new name and delete the opened dashboard, respectively.

To add a custom functionality, create and implement a custom extension class and define an extension template. After that call the DashboardControl.registerExtension method to add this functionality to the Web Dashboard.

The image below shows the result of the extensions implementation.

wdd-custom-extension-save-as.png

using Storages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MVC_WebDashboard.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult DeleteDashboard(string DashboardID) {
            CustomDashboardFileStorage newDashboardStorage = new CustomDashboardFileStorage(@"~/App_Data/Dashboards");
            newDashboardStorage.DeleteDashboard(DashboardID);
            return new EmptyResult();
        }

    }
}