Updatable Dashboard "Select All" Option?

Create a UI customization on your deployed dashboard assembly.

/* Grab your grid */
    EpiUltraGrid myGrid
    {
        get
        {
            return (EpiUltraGrid)
                csm.GetNativeControlReference("facaf8c0-2602-4d72-9bf5-ec9b6c63170f");
        }
    }

/* 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["Calculated_FirmJob"].Value = val; /* change to whatever column you are updating for selection */
        }
    }
2 Likes