Skip to main content
A newer version of this page is available. .
Tab

ASPxPopupControl.CloseAction Property

Gets or sets a value that specifies which action forces a displayed popup window to close.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(CloseAction.OuterMouseClick)]
public CloseAction CloseAction { get; set; }

Property Value

Type Default Description
CloseAction **OuterMouseClick**

One of the CloseAction enumeration values.

Available values:

Name Description
None

Specifies that a popup element can’t be closed via an end-user interaction, but can be closed programmatically via specific client script methods.

CloseButton

Specifies that a popup element is closed when clicking its close button (if any).

OuterMouseClick

Specifies that a popup element is closed when clicking a mouse button outside the popup element.

MouseOut

Specifies that a popup element is closed when the mouse cursor moves out of it.

Remarks

A displayed popup window may be closed in response to a specific mouse action performed on the client side (such as a mouse click or mouse movement). Use the CloseAction property to specify the precise client action which will hide the popup control’s popup window.

Example

This example demonstrates how to add OK and Cancel buttons to a popup window of the ASPxPopupControl. It shows how to process new data when the OK button is pressed, and how to close the popup window without saving anything, when Cancel is pressed.See Also:

How to show and hide a popup window via server side code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to implement OK and Cancel buttons for a modal popup window</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <dx:ASPxTextBox ID="ASPxTextBox1" runat="server" Width="170px" ClientInstanceName="txtMain"
                ClientEnabled="False" Text="test message">
            </dx:ASPxTextBox>
            <dx:ASPxButton ID="ASPxButton1" runat="server" Text="Edit..." AutoPostBack="False">
                <ClientSideEvents Click="function(s, e) { txtPopup.SetText(txtMain.GetText()); popupControl.Show(); }" />
            </dx:ASPxButton>
            <dx:ASPxPopupControl ID="ASPxPopupControl1" runat="server" ClientInstanceName="popupControl"
                Height="83px" Modal="True" CloseAction="CloseButton" Width="207px" AllowDragging="True"
                PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
                <ContentCollection>
                    <dx:PopupControlContentControl runat="server">
                        Text:<dx:ASPxTextBox ID="ASPxTextBox2" runat="server" Width="170px" ClientInstanceName="txtPopup">
                        </dx:ASPxTextBox>
                        <br />
                        <br />
                        <table style="border: none">
                            <tr>
                                <td>
                                    <dx:ASPxButton ID="btnOK" runat="server" AutoPostBack="False" Text="OK" Width="80px"
                                        OnClick="btnOK_Click">
                                        <ClientSideEvents Click="function(s, e) { popupControl.Hide();
                                                // client-side processing is here
                                                e.processOnServer = true;
                                                // do some processing at the server side
                                            }" />
                                    </dx:ASPxButton>
                                </td>
                                <td>
                                    <dx:ASPxButton ID="btnCancel" runat="server" AutoPostBack="False" ClientInstanceName="btnCancel"
                                        Text="Cancel" Width="80px">
                                        <ClientSideEvents Click="function(s, e) { popupControl.Hide(); }" />
                                    </dx:ASPxButton>
                                </td>
                            </tr>
                        </table>
                    </dx:PopupControlContentControl>
                </ContentCollection>
            </dx:ASPxPopupControl>
        </div>
    </form>
</body>
</html>
See Also