# CommonDialog

URL: https://docs.wisej.com/api/wisej.web/common-dialogs/wisej.web.commondialog

Version: 4.1
Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.1.0.0)

Specifies the base class used for displaying dialog boxes on the screen.

- C# - VB.NET

```csharp
public class CommonDialog : Component
```

```visual
Public Class CommonDialog
    Inherits Component
```

## Constructors

### ![Instance member](/img/api/instance.png) CommonDialog()

Initializes a new instance of [CommonDialog](/api/wisej.web/common-dialogs/wisej.web.commondialog) .

### ![Instance member](/img/api/instance.png) CommonDialog(container)

Initializes a new instance of the [CommonDialog](/api/wisej.web/common-dialogs/wisej.web.commondialog) extender with a specified container.

| Name | Type | Description | **container** | [IContainer](https://docs.microsoft.com/dotnet/api/system.componentmodel.icontainer) | An [IContainer](https://docs.microsoft.com/dotnet/api/system.componentmodel.icontainer) that represents the container of the [CommonDialog](/api/wisej.web/common-dialogs/wisej.web.commondialog) component. 

## Properties

### ![Instance member](/img/api/instance.png) DialogTemplate

[Type](https://docs.microsoft.com/dotnet/api/system.type) : Returns or sets the type of the common dialog UI control to show when calling the [ShowDialog](/api/wisej.web/common-dialogs/wisej.web.commondialog#showdialog) method. (Default: `null` )

### ![Instance member](/img/api/instance.png) Tag

[Object](https://docs.microsoft.com/dotnet/api/system.object) : Returns or sets an object that contains data about the control. (Default: `null` )

### ![Instance member](/img/api/instance.png) Title

[String](https://docs.microsoft.com/dotnet/api/system.string) : Returns or sets the dialog box title. (Default: `""` )

### ![Instance member](/img/api/instance.png) WindowState

[FormWindowState](/api/wisej.web/containers/form/wisej.web.formwindowstate) : Returns or sets the initial [WindowState](/api/wisej.web/common-dialogs/wisej.web.commondialog#windowstate) of the common dialog. (Default: `Normal` )

## Methods

### ![Protected member](/img/api/protected.png) CreateUI()

Creates the UI for the CommonDialog.

**Returns:**Form . An instance ofForm .

### ![Protected member](/img/api/protected.png) Dispose(disposing)

| Parameter | Type | Description | **disposing** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | 

### ![Protected member](/img/api/protected.png) OnHelpRequested(e)

Fires the [HelpRequested](/api/wisej.web/common-dialogs/wisej.web.commondialog#helprequested) event.

| Parameter | Type | Description | **e** | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [HelpEventArgs](/api/wisej.web/containers/control/wisej.web.helpeventargs) that provides the event data. 

### ![Instance member](/img/api/instance.png) Reset()

When overridden in a derived class, resets the properties of a common dialog box to their default values.

### ![Instance member](/img/api/instance.png) ShowDialog()

Runs a common dialog box with a default owner.

**Returns:**[DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult) . [OK](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) if the user clicks OK in the dialog box; otherwise, [Cancel](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) .

### ![Instance member](/img/api/instance.png) ShowDialog(onclose)

Runs a common dialog box with a default owner.

| Parameter | Type | Description | **onclose**![optional](/img/api/badge-optional.svg) | [Action<DialogResult>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional async handler for the close event; called when the form/dialog has been closed. It's the equivalent of handling the [event.](/api/wisej.web/containers/form/#formclosed) When the *onclose* event handler is specified, the modal dialog doesn't suspend the execution on the server but it's still shown as a modal dialog on the client. 

**Returns:**[DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult) . [OK](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) if the user clicks OK in the dialog box; otherwise, [Cancel](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) .

### ![Instance member](/img/api/instance.png) ShowDialog(owner)

Runs a common dialog box with the specified owner.

| Parameter | Type | Description | **owner** | Form | AForm that represents the top-level window that owns the modal dialog box. It can be null. 

**Returns:**[DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult) . [OK](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) if the user clicks OK in the dialog box; otherwise, [Cancel](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) .

### ![Instance member](/img/api/instance.png) ShowDialog(owner, onclose)

Runs a common dialog box with the specified owner.

| Parameter | Type | Description | **owner** | Form | AForm that represents the top-level window that owns the modal dialog box. It can be null. | **onclose**![optional](/img/api/badge-optional.svg) | [Action<DialogResult>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional async handler for the close event; called when the form/dialog has been closed. It's the equivalent of handling the [event.](/api/wisej.web/containers/form/#formclosed) When the *onclose* event handler is specified, the modal dialog doesn't suspend the execution on the server but it's still shown as a modal dialog on the client. 

**Returns:**[DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult) . [OK](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) if the user clicks OK in the dialog box; otherwise, [Cancel](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) .

### ![Instance member](/img/api/instance.png) ShowDialogAsync(owner)

Runs a common dialog box with the specified owner asynchronously.

| Parameter | Type | Description | **owner**![optional](/img/api/badge-optional.svg) | Form | AForm that represents the top-level window that owns the modal dialog box. It can be null. 

**Returns:**[Task<DialogResult>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1) . [OK](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) if the user clicks OK in the dialog box; otherwise, [Cancel](/api/wisej.web/enumerations/wisej.web.dialogresult#fields) .

## Events

### ![Instance member](/img/api/instance.png) HelpRequested

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the user clicks the Help button on a common dialog box.

## Inherited By

| Name | Description | [ColorDialog](/api/wisej.web/common-dialogs/wisej.web.colordialog) | Represents a common dialog box that displays available colors along with controls that enable the user to define custom colors. | [FileDialog](/api/wisej.web/common-dialogs/wisej.web.filedialog) | Displays a dialog box from which the user can select a file. | [FolderBrowserDialog](/api/wisej.web/common-dialogs/wisej.web.folderbrowserdialog) | Allows the user to select a folder from one of the [Roots](/api/wisej.web/common-dialogs/wisej.web.folderbrowserdialog#roots) . | [OpenFileDialog](/api/wisej.web/common-dialogs/wisej.web.openfiledialog) | Prompts the user to open a file from the server. | [SaveFileDialog](/api/wisej.web/common-dialogs/wisej.web.savefiledialog) | Prompts the user to select a location for saving a file on the server.
