ASPxPopupControlBase.ShowCloseButton Property
Gets or sets a value that specifies whether a window’s close button is displayed.
Namespace: DevExpress.Web
Assembly:
DevExpress.Web.v24.2.dll
Declaration
Property Value
Type |
Default |
Description |
Boolean |
true |
true if a window’s close button is displayed; otherwise, false .
|
Example
The ASPxPopupControl does not allow a developer to prevent a PopupControl from being hidden when the CloseButton is clicked based on a custom criteria. A possible solution for this limitation is to use templates. You should add a button to the PopupControl's HeaderTemplate container and decide whether a PopupControl should be closed or not when this button is clicked.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e) {
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MasterPageFile="~/MasterPage.master"%>
<%@ Register Assembly="DevExpress.Web.v8.1, Version=8.1.6.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4"
Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" ID="CC" runat="Server">
<input id="Button1" style="width: 325px" type="button" value="Click button to show PopupControl" /><br />
<dxpc:ASPxPopupControl ID="ASPxPopupControl1" runat="server" PopupElementID="Button1" ClientInstanceName="popupControl"
ShowCloseButton="False">
<HeaderTemplate>
<div style="text-align:right;">
<input id="btn" type="button" value="close" onclick="
if(document.getElementById('checkBox').checked)
popupControl.Hide();
"/>
</div>
</HeaderTemplate>
<ContentCollection>
<dxpc:PopupControlContentControl runat="server">
<label id="lbl">Check CheckBox to be able to close the PopupControl by clicking the Hide button</label>
<input id="checkBox" style="width: 32px" type="checkbox"/>
</dxpc:PopupControlContentControl>
</ContentCollection>
</dxpc:ASPxPopupControl>
</asp:Content>
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" MasterPageFile="~/MasterPage.master"%>
<%@ Register Assembly="DevExpress.Web.v8.1, Version=8.1.6.0, Culture=neutral, PublicKeyToken=9B171C9FD64DA1D1"
Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" ID="CC" runat="Server">
<input id="Button1" style="width: 325px" type="button" value="Click button to show PopupControl" /><br />
<dxpc:ASPxPopupControl ID="ASPxPopupControl1" runat="server" PopupElementID="Button1" ClientInstanceName="popupControl"
ShowCloseButton="False">
<HeaderTemplate>
<div style="text-align:right;">
<input id="btn" type="button" value="close" onclick="
if(document.getElementById('checkBox').checked)
popupControl.Hide();
"/>
</div>
</HeaderTemplate>
<ContentCollection>
<dxpc:PopupControlContentControl runat="server">
<label id="lbl">Check CheckBox to be able to close the PopupControl by clicking the Hide button</label>
<input id="checkBox" style="width: 32px" type="checkbox"/>
</dxpc:PopupControlContentControl>
</ContentCollection>
</dxpc:ASPxPopupControl>
</asp:Content>
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Partial Public Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
End Class
See Also