Using buttons to modify the properties of a DashboardUltraGrid

Is this possible? I can use buttons with an EpiUltraGrid to change the GroupBy, Expand, Collapse, etc, but can’t seem to do it with a DashboardUltraGrid. I included a “using Ice.UI.Dashboard;”, but on trying to initialize I get the error: ‘Ice.UI.Dashboard.DashboardUltraGrid’ is inaccessible due to its protection level.

Edit: I tried to add the customization after deployment. Same error using a DashboardUltraGrid. Initializing the grid as a an epiUltraGrid compiles, but on the event errors on a bad Guid even though the Guid was correct. : Message:
Exception has been thrown by the target of an invocation.
Inner Exception Message: Control with specified EpiGuid property does not exist.

csm.GetNativeControlReference(“c452b038-71d8-4b88-b022-1d75ab885286”)
Program: CommonLanguageRuntimeLibrary
Method: InvokeMethod

The dashboard is actually assigning a new GUID every time the form is loaded, which is unlike the behavior in other assemblies. I must be doing something horribly wrong.

Are you turning the dashboard into an assembly (smart client)? If not, you want to do that and place the customization on top of that.

That’s what I tried in the second attempt, but can’t figure out why the assembly is assigning a new guid every time. I’m going to rebuild from scratch to see if the error goes away.

Starting from scratch worked. I’ve learned my lesson not to attempt using the “Customize Tracker View” option in the Dashboard designer.


Here’s some free code FFR, with everything needed to buttonize the UltraGrid GroupBy and Expand/Collapse behaviors:

// **************************************************
// Custom code for MainController
// Created: 16-May-2019 10:09:45
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Win.UltraWinGrid;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		this.epiButtonExpand.Click += new System.EventHandler(this.epiButtonExpand_Click);
		this.epiButtonGBjobnum.Click += new System.EventHandler(this.epiButtonGBjobnum_Click);
		this.epiButtonGBasmpartnum.Click += new System.EventHandler(this.epiButtonGBasmpartnum_Click);
		this.epiButtonGBmtlpartnum.Click += new System.EventHandler(this.epiButtonGBmtlpartnum_Click);
		this.epiButtonGBrem.Click += new System.EventHandler(this.epiButtonGBrem_Click);
		this.epiButtonCollapse.Click += new System.EventHandler(this.epiButtonCollapse_Click);
		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		this.epiButtonExpand.Click -= new System.EventHandler(this.epiButtonExpand_Click);
		this.epiButtonGBjobnum.Click -= new System.EventHandler(this.epiButtonGBjobnum_Click);
		this.epiButtonGBasmpartnum.Click -= new System.EventHandler(this.epiButtonGBasmpartnum_Click);
		this.epiButtonGBmtlpartnum.Click -= new System.EventHandler(this.epiButtonGBmtlpartnum_Click);
		this.epiButtonGBrem.Click -= new System.EventHandler(this.epiButtonGBrem_Click);
		this.epiButtonCollapse.Click -= new System.EventHandler(this.epiButtonCollapse_Click);
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

   	private void epiButtonExpand_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
			EpiUltraGrid myGrid = (EpiUltraGrid)csm.GetNativeControlReference("b204b568-7d7a-4ec2-acb1-4143a9f1a4a2");
			myGrid.Rows.ExpandAll(true);
	}

	private void epiButtonGBjobnum_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
			EpiUltraGrid myGrid = (EpiUltraGrid)csm.GetNativeControlReference("b204b568-7d7a-4ec2-acb1-4143a9f1a4a2");
			myGrid.DisplayLayout.ClearGroupByColumns();
			myGrid.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
			myGrid.DisplayLayout.Bands[0].SortedColumns.Add("JobAsmbl1_JobNum", false, true);

	}

	private void epiButtonGBasmpartnum_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
			EpiUltraGrid myGrid = (EpiUltraGrid)csm.GetNativeControlReference("b204b568-7d7a-4ec2-acb1-4143a9f1a4a2");
			myGrid.DisplayLayout.ClearGroupByColumns();
			myGrid.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
			myGrid.DisplayLayout.Bands[0].SortedColumns.Add("JobAsmbl1_PartNum", false, true);

	}

	private void epiButtonGBmtlpartnum_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
			EpiUltraGrid myGrid = (EpiUltraGrid)csm.GetNativeControlReference("b204b568-7d7a-4ec2-acb1-4143a9f1a4a2");
			myGrid.DisplayLayout.ClearGroupByColumns();
			myGrid.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
			myGrid.DisplayLayout.Bands[0].SortedColumns.Add("JobMtl_PartNum", false, true);

	}

	private void epiButtonGBrem_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
			EpiUltraGrid myGrid = (EpiUltraGrid)csm.GetNativeControlReference("b204b568-7d7a-4ec2-acb1-4143a9f1a4a2");
			myGrid.DisplayLayout.ClearGroupByColumns();
	}

	private void epiButtonCollapse_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
			EpiUltraGrid myGrid = (EpiUltraGrid)csm.GetNativeControlReference("b204b568-7d7a-4ec2-acb1-4143a9f1a4a2");
			myGrid.Rows.CollapseAll(true);
	}

}
3 Likes