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.v24.2.dll
Declaration
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.
<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();
// Processes data on the client
e.processOnServer = true;
// Processes data on the server
}" />
</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>
using System;
public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
}
protected void btnOK_Click(object sender, EventArgs e) {
// Processes data on the server
ASPxTextBox1.Text = ASPxTextBox2.Text;
}
}
See Also:
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CloseAction property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.