Developer Resources
DialogResult
Overview
Class encapsulates a dialog result.
Properties
- DialogResult.Ok
- A flag that is used to add an OK button to an alert message. If the OK button is clicked, this is also the return value for the alert message.
- DialogResult.Cancel
- A flag that is used to add a Cancel button to an alert message. If the Cancel button is clicked, this is also the return value for the alert message.
- DialogResult.Yes
- A flag that is used to add a Yes button to an alert message. If the Yes button is clicked, this is also the return value for the alert message.
- DialogResult.No
- A flag that is used to add a No button to an alert message. If the No button is clicked, this is also the return value for the alert message.
- DialogResult.YesNo
- A flag that is used to add Yes and No buttons to an alert message.
- DialogResult.Abort
- A flag representing that the Abort button was clicked in a dialog.
- DialogResult.Retry
- A flag representing that the Retry button was clicked in a dialog.
- DialogResult.Ignore
- A flag representing that the Ignore button was clicked in a dialog.
Example
// create an alert message with Yes and No buttons alert("Are you sure you would like to continue?", "Title", DialogResult.YesNo); // create an alert message with OK and Cancel buttons alert("Message", "Title", DialogResult.Ok | DialogResult.Cancel); // create an alert message and only execute the code if the Yes button is pressed if (alert("Are you sure you would like to continue?", "Title", DialogResult.YesNo) == DialogResult.Yes) { // code to execute if the Yes button is pressed alert("Yes was clicked!"); }