Updateable Dashboard Check All Button in GridView

I have an updateable dashboard with a user defined field. “Packed_c”
I would like to add a button to check all Rows with Packed_c = true.

I have seen a post that suggests a UI Customization over the Deployed Dashboard.
I am unable to get the code to work.

https://www.epiusers.help/t/updatable-dashboard-select-all-option/44343/3?u=mnewman

<
Create a UI customization on your deployed dashboard assembly.

// **************************************************
// Custom code for MainController
// Created: 12/16/2019 8:33:30 AM
// **************************************************
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;

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

	// 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

		// 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

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
/* Grab your grid */
    EpiUltraGrid myGrid
    {
        get
        {
            return (EpiUltraGrid)
                csm.GetNativeControlReference("589716ee-c705-4062-9288-a2cc6a726587");
        }
    }

/* if you want to select all, you'll want to unselect all sooner or later */
    private void btnUnSelectAll_Click(object sender, System.EventArgs args)
    {
        ChangeAll(myGrid.Rows, false);
        myGrid.Selected.Rows.Clear();
    }

/* confirmation msg box is entirely optional */
    private void btnSelectAll_Click(object sender, System.EventArgs args)
    {
        int cnt = myGrid.Rows.Count;
        string msg = string.Format("There are '{0}' rows in the grid.  Are you really realy REALLY sure you want to select ALL '{0}' rows?  Click Yes to confrim, No to cancel", cnt);
        if (MessageBox.Show(msg, "Select all the jobs", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
        {
            ChangeAll(myGrid.Rows, true);
        }
    }

/* why is this it's own function?  well it can handle selecting and unselecting and it can handle grouping within your grid */
    public void ChangeAll(RowsCollection row, bool val)
    {
        foreach (UltraGridRow r in row)
        {
            if (r.GetType() == typeof(UltraGridGroupByRow))
                ChangeAll(((UltraGridGroupByRow)r).Rows, val);
            else
                r.Cells["OrderRel_Packed_c"].Value = val; /* change to whatever column you are updating for selection */
        }
    }


}

Get an error on RowsCollection

Any Suggestions on what I am missing?

What is the exact error you are getting?

Error: CS0246 - line 82 (188) - The type or namespace name ‘RowsCollection’ could not be found (are you missing a using directive or an assembly reference?)

Add this using at the top

using Infragistics.Win.UltraWinGrid;
1 Like

Thank You!! THAT DID IT! :smiley:

Hi,

I have done something similar in terms of updating multiple rows in a grid. In my example I am allowing the operator to update the order release ship via. So the code actually looks for the order number on the selected row and then loops through the grid updating the shipvia code for all rows where the order number matches. This is working perfectly until the grid is grouped at which point it fails with an Object reference not set to an instance of an object. error. Do we need to handle grids differently if groups are introduced?

1 Like

Actually I think I have resolved my issue here. I updated the data view instead of the grid. So I get the order number from the selected row in the grid and then update matching records in the view.

Seems to work

Hi Michael,

where do you get the value “589716ee-c705-4062-9288-a2cc6a726587” that you use in the csm.GetNativeControlReference() method?

Thank you,

Daniel

I will have to check that out and get back to you.

I know its in the customization though

I actually found it a few minutes after I sent this. It is in the properties tab of the customization. Thanks for following up.

In the customization screen choose the tab you want to update

You will see it here.

Then you will see it in the properties window

In the customization screen choose the tab you want to update

You will see it here.

Then you will see it in the properties window

Thank you

1 Like

Where are you getting the GUID for the EpiUltraGrid? Can this be used on the standard Summary Grid or do you need to buld a custom UltraGrid? I am trying to do something similar to check all the checkboxes in the Summary Grid with a select all button.

I believe it must be a custom grid