Activate "Select" checkbox to select rows from Dashboard Grid and then execute Code

I added a Button to a Dashboard that when they highlight rows and press the Copy Button it copies Order/Line/Rel and 0 to the clipboard. Then they could paste this data directly to Customer Shipment Entry to add those lines in mass.

163652 1 1 0
163652 1 2 0
163652 1 3 0

What I want to do instead of highlighting the rows, is to check a “Select” box that I added. So then the user presses the button and copies the data. See image, first field is “Select”.

I’ve already try to reverse engineer some things on my own, but could not figure it out. I assume you need to make the “Select” field Active after it loads the Dashboard. Then with some code the button will read the boxes checked instead of the highlighted rows.

I also want to add a button to add a shortcut to “Sales Order Pick List”, so instead of going to back thru menu, they could open the Print Report directly and paste the Data and Print.

Could someone help? Thanks,

1 Like

What have you done thus far (your code) and where are you stuck?

So far just have the code for the Copy button. I don’t know what do next in order to Activate the Select Box in the Grid so users can check and uncheck it. Then the plan is to run the Code from the Button on those checked rows.

public class Script
{
	public void InitializeCustomCode()
	{		
		this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
		this.epiButtonC2.Click += new System.EventHandler(this.epiButtonC2_Click);
		
	}

	public void DestroyCustomCode()
	{	
		this.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click);
		this.epiButtonC2.Click -= new System.EventHandler(this.epiButtonC2_Click);
	}


	private void epiButtonC1_Click(object sender, System.EventArgs args)
	{
	
		EpiUltraGrid eugOD = (EpiUltraGrid)csm.GetNativeControlReference("3b8c933f-cf47-48d1-8ad1-03f6b1ba46b3");
	
		string strBuilder = "";
	
		foreach(var r in eugOD.Selected.Rows)
		{
			strBuilder += r.Cells["OrderRel_OrderNum"].Text.ToString() + "\t" + r.Cells["OrderRel_OrderLine"].Text.ToString() + "\t" + r.Cells["OrderRel_OrderRelNum"].Text.ToString() + "\t" + 0 + Environment.NewLine;
		}
	  
	    Clipboard.SetText(strBuilder);
	}
	  
	
	private void epiButtonC2_Click(object sender, System.EventArgs args)
	{

		EpiUltraGrid eugOD = (EpiUltraGrid)csm.GetNativeControlReference("3b8c933f-cf47-48d1-8ad1-03f6b1ba46b3");

		string strBuilder = "";

		foreach(var r in eugOD.Selected.Rows)
		{
			strBuilder += r.Cells["OrderRel_OrderNum"].Text.ToString() + Environment.NewLine;
		}
	  
	    Clipboard.SetText(strBuilder);
	}
} ```

Are you wanting the rows that the user highlights/selects to mark the (I’m assuming unbound) checkbox to true? And then the click event on your button(s) will copy fields from the selected rows?

Either way, there are at least 2 ways to go about this (that I know of).
The first is to go after the dataview itself versus the grid control, if you want to stick with the dashboard approach. In this way, you’d establish the dataview driving the grid and you could loop through the selected rows from that. I don’t think you’d need to necessarily have the two step thing of a checkbox, especially if you are simply selecting the same rows.

This example selects a single row, but I’m sure you could select multiple.

private void btnSelect_Click(object sender, System.EventArgs args)
{
	// ** Place Event Handling Code Here **
	EpiDataView edvQ = (EpiDataView)oTrans.EpiDataViews["V_JRF_Quotes_1View"];
	int QuoteNum = Convert.ToInt32(edvQ.dataView[edvQ.Row]["QuoteDtl_QuoteNum"]);
	int QuoteLine = Convert.ToInt32(edvQ.dataView[edvQ.Row]["QuoteDtl_QuoteLine"]);		
	//show your variables if you want
}

The second way I know is if you have a custom grid and you’ve added a BAQ behind it to control the data in the grid. This way gives you a lot of relatively simple flexibility with custom columns like “Select”.
This example loops through a custom grid and checks the row for the value of a custom “Add” checkbox.

foreach (UltraGridRow selectedRow in grdAvailableToPurchase.Rows)
{
	if ((bool)selectedRow.Cells["Add"].Value) 
	{
		lot = (string)selectedRow.Cells["UD100_Key1"].Value.ToString();
		part = (string)selectedRow.Cells["UD100_Key2"].Value.ToString();
	}
}

I have some examples along those lines here…

After reading the messages in this post, and digging thru other posts I figured out the solution. You need to enable Infragistics. The first code (Main Controller_Load) will enable the Column Activation and the Second (SetExtendedProperties) enables the column and makes it editable.

Thanks to all.


using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;


                private void MainController_Load(object sender, EventArgs args)
                {

                                EpiUltraGrid grdJobRelease = (EpiUltraGrid)csm.GetNativeControlReference("0297fc5c-4168-456b-a1c8-ef89b3805159");
                                grdJobRelease.DisplayLayout.Bands[0].Columns["Calculated_SelectJob"].CellActivation = Activation.AllowEdit;
                }

                private void SetExtendedProperties()
                {

                
                                EpiDataView edvJobRelease = ((EpiDataView)(this.oTrans.EpiDataViews["V_OMS_Release_Jobs_1View1"]));



                                if (edvJobRelease.dataView.Table.Columns.Contains("Calculated_SelectJob"))
                                {


                                                edvJobRelease.dataView.Table.Columns["Calculated_SelectJob"].ExtendedProperties["Enabled"] = true;
                                                edvJobRelease.dataView.Table.Columns["Calculated_SelectJob"].ExtendedProperties["ReadOnly"] = false;


                }
}

I know I’m late to this one, but a lot simpler way to get checkboxes is to make a bit calculated field in the BAQ and set that field as updateable. It will allow you to check the box in the dashboard.

I agree with Brandon, and that’s how we did it. Simple calc/updateable field on the BAQ. Then a little code will cycle through all the rows with the checkbox checked.