Back to Devexpress

ASPxPopupControlBase.ShowOnPageLoad Property

aspnet-devexpress-dot-web-dot-aspxpopupcontrolbase-e741fff7.md

latest9.7 KB
Original Source

ASPxPopupControlBase.ShowOnPageLoad Property

Gets or sets a value that specifies whether the window is automatically displayed when a client browser loads the page.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(false)]
public virtual bool ShowOnPageLoad { get; set; }
vb
<DefaultValue(False)>
Public Overridable Property ShowOnPageLoad As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true, if the window is displayed on the page load; otherwise, false.

|

Remarks

The ShowOnPageLoad property can’t be changed during a callback.

Note

For ASPxPopupControl only:

If the ASPxPopupControl.Windows collection is not empty, the ShowOnPageLoad property is not in effect, and cannot be used to specify a common page load behavior for all popup windows. In this case, use the PopupWindow.ShowOnPageLoad property of individual popup windows from the collection.

Online Examples

View Example: How to return values from the content collection and close the pop-up window on the client or server

View Example: How to show and hide a pop-up window on the server side

Example

In this example, the client BringToFront method of an ASPxPopupControl is used to display the control's default window above other popup windows displayed on the page.

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

<%@ Register Assembly="DevExpress.Web.v13.1" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.v13.1" Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>

<!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>Untitled Page</title>

    <script type="text/javascript">
        function BringWindow1ToFront() {
            popupControl1.BringToFront();
        }
        function BringWindow2ToFront() {
            popupControl2.BringToFront();
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <td width="250px">
                        <dxpc:ASPxPopupControl ID="pc1" ClientInstanceName="popupControl1" runat="server" 
                            HeaderText="Window1" ShowOnPageLoad="True" Top="10" Left="10" CloseAction="CloseButton">
                            <ContentCollection>
                                <dxpc:PopupControlContentControl runat="server" />
                            </ContentCollection>
                        </dxpc:ASPxPopupControl>
                        <dxpc:ASPxPopupControl ID="pc2" ClientInstanceName="popupControl2" runat="server" 
                            HeaderText="Window2" ShowOnPageLoad="True" Top="20" Left="20" CloseAction="CloseButton">
                            <ContentCollection>
                                <dxpc:PopupControlContentControl runat="server" />
                            </ContentCollection>
                        </dxpc:ASPxPopupControl></td>
                    <td valign="top">
                        <dxe:ASPxButton ID="btn1" runat="server" Text="Window1 to front" AutoPostBack="False">
                            <ClientSideEvents Click="BringWindow1ToFront" />
                        </dxe:ASPxButton></td>
                    <td valign="top">
                        <dxe:ASPxButton ID="btn2" runat="server" Text="Window2 to front" AutoPostBack="False">
                            <ClientSideEvents Click="BringWindow2ToFront" />
                        </dxe:ASPxButton></td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>
csharp
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 PopupControl_BringToFrontSample : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {

    }
}
vb
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 PopupControl_BringToFrontSample
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    End Sub
End Class
aspx
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="PopupControl_BringToFrontSample" %>

<%@ Register Assembly="DevExpress.Web.v13.1" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.v13.1" Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>

<!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>Untitled Page</title>

    <script type="text/javascript">
        function BringWindow1ToFront() {
            popupControl1.BringToFront();
        }
        function BringWindow2ToFront() {
            popupControl2.BringToFront();
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <td width="250px">
                        <dxpc:ASPxPopupControl ID="pc1" ClientInstanceName="popupControl1" runat="server" 
                            HeaderText="Window1" ShowOnPageLoad="True" Top="10" Left="10" CloseAction="CloseButton">
                            <ContentCollection>
                                <dxpc:PopupControlContentControl runat="server" />
                            </ContentCollection>
                        </dxpc:ASPxPopupControl>
                        <dxpc:ASPxPopupControl ID="pc2" ClientInstanceName="popupControl2" runat="server" 
                            HeaderText="Window2" ShowOnPageLoad="True" Top="20" Left="20" CloseAction="CloseButton">
                            <ContentCollection>
                                <dxpc:PopupControlContentControl runat="server" />
                            </ContentCollection>
                        </dxpc:ASPxPopupControl></td>
                    <td valign="top">
                        <dxe:ASPxButton ID="btn1" runat="server" Text="Window1 to front" AutoPostBack="False">
                            <ClientSideEvents Click="BringWindow1ToFront" />
                        </dxe:ASPxButton></td>
                    <td valign="top">
                        <dxe:ASPxButton ID="btn2" runat="server" Text="Window2 to front" AutoPostBack="False">
                            <ClientSideEvents Click="BringWindow2ToFront" />
                        </dxe:ASPxButton></td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ShowOnPageLoad 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.

asp-net-web-forms-popup-change-visibility/CS/PopupInputFormServerSide/Default.aspx.cs#L19

csharp
txtPopup.Text = txtMain.Text;
    ASPxPopupControl1.ShowOnPageLoad = true;
}

asp-net-web-forms-popup-change-visibility/VB/PopupInputFormServerSide/Default.aspx.vb#L17

vb
txtPopup.Text = txtMain.Text
    ASPxPopupControl1.ShowOnPageLoad = True
End Sub

See Also

PopupElementID

ShowOnPageLoad

ASPxPopupControlBase Class

ASPxPopupControlBase Members

DevExpress.Web Namespace