The button command specifies the action taken, or transaction performed, by the button when it is clicked.
|
|
The button command specifies what transaction operation the button performs when it is clicked. |
|
Button Command |
Description |
|
Add row to |
Add a new record to the database. Processing does not wait until a final “Submit” or “OK” button is clicked. |
|
Apply search and filter to |
Applies the current filtering criteria, including a search, to the control. This operation is normally used for the “Go” button in a search panel or a dropdown filter. The search term is entered into a separate text box field. |
|
Custom |
An application-defined custom command is executed when the button is clicked. See Calling a Custom Function when a Button is Clicked for details. |
|
Delete current record |
In Show Record panels, the selected record is deleted from the database immediately. Processing does not wait until a final “Submit” or “OK” button is clicked. In Edit Record panels, the selected record is removed from the control so that it is no longer displayed. The record is deleted from the database and the transaction committed only after a final “Save”, “Submit” or “OK” button is clicked. Note: The ‘Delete current record’ command will only delete the designated record. It will not delete related records that refer to the deleted record. See Deleting Related Records for details. |
|
Delete selected row from |
In Show Table panels, the selected record(s) are deleted from the database immediately. Processing does not wait until a final “Submit” or “OK” button is clicked. In Edit Table panels, the selected record(s) are removed from the control so that they are no longer displayed. The record(s) are physically deleted from the database and the transaction committed only after a final “Save”, “Submit” or “OK” button is clicked. Note: The ‘Delete selected row from’ command will only delete the designated record(s). It will not delete related records that refer to the deleted record(s). See Deleting Related Records for details. |
|
Export data from |
Export data from the associated table. A file selection dialog is displayed when an Export Data button is clicked, prompting the application user for a file name into which the data is exported. |
|
Pagination |
|
|
Redirect |
|
|
Refresh page |
Restores the current page (or form) to its last presented state. For Add Record pages, the input fields are cleared of any data entered into them. For Edit Record pages, the data fields are restored to their original values from the database. Refresh page causes record controls and table controls to refresh their data from the database, even if the fresh data was from a concurrent modification by another user. I.e., the most current data is always retrieved from the database. It does not restore from the web browser’s local cache. Note: Refreshing a page does not reset the filter settings or clear the search text box. To clear the filters and search text box, simply redirect to the same page using the “Go to a specific URL” Action After Command option. |
|
Save data on page |
Any input data and edited values on the page are updated (saved) into the database. Any deleted records are removed from the database. |
|
Save data on table or record |
Any input data and edited values in the selected table or record are updated (saved) into the database. Any deleted records are removed from the database. |
|
Sign out |
Sign out of the application. The application user is logged out. The Sign Out event is always consumed by the Page unless some form of code customization is employed relating to this event. |
|
Option |
Description |
|
Custom |
You can enter any command of your own. When clicked, the button will emit an event by this name, which can be intercepted in a code extension to your application and processed. See Calling a Custom Function when a Button is Clicked for details |
|
Validate page data |
You can call custom code functions of your own when a button is clicked. The invoked code is typically placed in the associated page’s customizable code-behind class (details about this are found elsewhere in the online help). To “catch” the function call, override the OnApplicationEvent function.
|
Tag Property |
Setting |
|
Button Text |
Export to PDF |
|
Button Command |
Send custom command |
|
Validate page data |
No |
|
Command name |
DisplayAsPDF |
For example, a button’s Properties dialog settings might have a custom function called “ExportToPDF” which is invoked when the button is clicked. The OnApplicationEvent function implements an event handler that is called when the new “Export to PDF” button is clicked. In this example, the DisplayReportAsPDF function connects to the data base, populates the report, and then displays it in the web browser.
' This method handles the ApplicationEvent produced by the ExportToPDF button
Public Overrides Sub OnApplicationEvent(ByVal args As BaseClasses.ApplicationEventArgs)
' Handle the custom "DisplayAsPDF" command, but pass others off to the base class
If args.EventType = BaseClasses.ApplicationEventArgs.EventTypes.Custom AndAlso _
args.CustomEventName = "DisplayAsPDF" Then
'' create the report object and produce the report
Dim crReportDocument As New ProductsList()
DisplayReportAsPDF(crReportDocument)
Else
' not the custom "DisplayAsPDF" command, pass it on
MyBase.OnApplicationEvent(args)
End If
End Sub
Sometimes when using the Delete Current Record button command, you may see this error in your application:
"Cannot delete Main. A record you were attempting to modify is referenced by other records."
This happens because the Delete Current Record function does not recursively delete all the records in other tables that reference the deleted record. For example, if an Order Detail record points to the main Order record, the Order record cannot be deleted unless the Order Details records that reference the particular Order record are deleted.
You can accomplish this in several ways.
If you are using Microsoft SQL Server, enable the "Cascade Delete Related Fields" feature through Enterprise Manager. Microsoft SQL Server will automatically remove the related records.
Delete the related records (e.g., Order Detail records) through your application before deleting the master record (e.g., the Order record).
Customize your application code to delete the Order Detail records before deleting the Order record. Do this by overriding the DeleteRecord method in the TableControl class. When overriding this method, delete the other (Order Detail) records first before calling the base DeleteRecord method:
Public Overrides Function DeleteRecord(ByVal recordIndex As Int32) As IRecord
To delete the OrderDetail records, write a simple “for” loop that goes through each record and calls the Delete method on each record. Retrieve the record group using the GetList method.