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

How to: Move an Existing Dashboard Item to Another Group

Important

This documentation applies to v16.2. Starting with v17.1, the ASPxDashboardViewer control is in maintenance mode. In v19.1, the new Web Dashboard Control replaces the old Web Dashboard Viewer. This means that the Web Dashboard Viewer will not be included in our installation packages. See our blog post for more information.

Refer to the following KB articles to learn how to migrate to ASPxDashboard / ASP.NET MVC Dashboard:

The following example demonstrates how to move an existing dashboard item from the dashboard item group to another group in code.

In this example, the ASPxDashboardViewer loads an existing dashboard with the predefined layout from an XML file.

The following steps are performed to move the combo box placed in the bottom group into the top group.

using System;
using DevExpress.DashboardWeb;
using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DashboardCommon;

namespace Dashboard_MoveItemFromGroupToGroup {
    public partial class WebForm1 : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
        }

        protected void ASPxDashboardViewer1_DashboardLoaded(object sender, 
            DashboardLoadedWebEventArgs e) {
            Dashboard dashboard = e.Dashboard;
            ComboBoxDashboardItem comboBox = 
                (ComboBoxDashboardItem)dashboard.Items["comboBoxDashboardItem1"];
            TreeViewDashboardItem treeView = 
                (TreeViewDashboardItem)dashboard.Items["treeViewDashboardItem1"];
            DashboardItemGroup topGroup = 
                (DashboardItemGroup)dashboard.Groups["dashboardItemGroup1"];

            DashboardLayoutGroup root = e.Dashboard.LayoutRoot;;
            DashboardLayoutItem comboBoxLayoutItem = root.FindRecursive(comboBox);
            DashboardLayoutItem treeViewLayoutItem = root.FindRecursive(treeView);
            DashboardLayoutGroup topGroupItem = root.FindRecursive(topGroup);

            comboBoxLayoutItem.MoveAbove(treeViewLayoutItem);            
            comboBox.Group = topGroup;             
        }

        protected void ASPxDashboardViewer1_ConfigureDataConnection(object sender, 
            ConfigureDataConnectionWebEventArgs e) {
                if (e.ConnectionName == "WebsiteStatisticsDataConnection") {
                XmlFileConnectionParameters parameters =
                    (XmlFileConnectionParameters)e.ConnectionParameters;
                string databasePath = Server.MapPath("App_Data/WebsiteStatisticsData.xml");                   
                parameters.FileName = databasePath;
            }
        }
    }
}
See Also