Button Click Event on Native Buttons

How do you work with the button click events for native buttons? The wizard doesn’t include those.
I’m trying to run some code when a user clicks the “Ship All” button in Customer Shipment Entry.

I tried declaring it using this: this.btnShipAll += new System.EventHandler(this.btnShipAll_Click); but it gives me an error of ‘Script’ does not contain a definition for ‘btnShipAll’ and no extension method ‘btnShipAll’ accepting a first argument of type ‘Script’ could be found (are you missing a using directive or an assembly reference?)

Try something like this. You will have to change the epIUltraGrid to the Button control.

	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

		gridMatParts = ((Ice.Lib.Framework.EpiUltraGrid)csm.GetNativeControlReference("74efd6bb-a282-4bc2-bcd4-135633814caa"));
		gridMatParts.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdTPLst_InitializeRow);
	}

Got it. Thanks @knash

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 **
	EpiButton btnShipAll;

	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

		EpiButton btnShipAll = (EpiButton)csm.GetNativeControlReference("8406d29d-9ed2-40ed-84ca-f9d2ea4d4f9a");
		btnShipAll.Click += new EventHandler(btnShipAll_Click);

		// End Wizard Added Custom Method Calls
	}
1 Like