ButtonClicked

Description

Occurs when the user clicks a button inside a DataWindow object.

Argument

Description

sender

Object. The source of the event.

row

Number. The number of the row the user clicked.

objectName

String. The name of the control within the DataWindow under the pointer when the user clicked.

Applies to

Web DataWindow client control

Returns

There are no special outcomes for this event. The only code is:

Usage

In DataWindow Designer, you can add buttons to a DataWindow with either a predefined action, such as Update or Retrieve, or a user-defined action. If you use a predefined action, the code to perform the action is provided for you. If you select User-Defined (the default) from the Action list in the DataWindow painter, you need to code a ButtonClicked event for the button.

ButtonClicked fires only for buttons with the UserDefined action. Other buttons cause the page to be reloaded from the server.

The ButtonClicked event executes code after the action assigned to the button has occurred.

This event is fired only if you have not selected Suppress Event Processing for the button.

If Suppress Event Processing is on, only the Clicked event and the action assigned to the button are executed when the button is clicked.

If Suppress Event Processing is off, the Clicked event and the ButtonClicked event are fired. If the return code of the ButtonClicking event is 0, the action assigned to the button is executed and the ButtonClicked event is fired. If the return code of the ButtonClicking event is 1, neither the action nor the ButtonClicked event are executed.

Examples

Example 1

Suppose you add two buttons named b_button1 and b_button2 to a DataWindow object in the DataWindow painter. You can add a ButtonClicked event handler to the Web DataWindow client control in .NET to perform a different action depending on which button was clicked. In the Properties window for the WebDataWindow control, click on the ClientEventButtonClicked property, select Add a New Event Handler, and add some code:

if (buttonName=="b_button1"){
   alert("Button 1 Clicked!");
}

if (buttonName=="b_button2"){
   alert("Button 2 Clicked!");
}

See also