To Use a Button to Invoke a Method
You can use the PXButton element on a form to invoke a method of the graph that provides business logic for the form.
To include in a container a button that invokes a method of the graph, perform the following
actions:
- Open the container in the Screen Editor, as described in To Open a Container in the Screen Editor.
- Add the button to the container, as described in To Add Another Supported Control.
- In the Control Tree of the Screen Editor, select the node of the new button.
- Click the Layout Properties tab item to open the list of properties for the button.
- Specify values for the following properties:
- CommandSourceID: Set the property to the value specified in the ID property of the PXDataSource control.
- CommandName: In the property, specify the name of the method to be
invoked when the user clicks the button on the form.Note: The method must be defined in the graph that is specified in the TypeName property of the PXDataSource control.
- Text: Specify the text to be displayed on the button.
- Click Save to save your changes to the customization project.
The following ASPX code creates a button that invokes the MethodName method referenced in the PXDataSource control with the ID property set to ds.
<px:PXButton ... CommandName="MethodName" CommandSourceID="ds" Text="ButtonText" />