Back to Devexpress

ASPxPopupControl.PopupHorizontalAlign Property

aspnet-devexpress-dot-web-dot-aspxpopupcontrol-37379980.md

latest8.1 KB
Original Source

ASPxPopupControl.PopupHorizontalAlign Property

Gets or sets a popup window’s horizontal alignment.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(PopupHorizontalAlign.NotSet)]
public PopupHorizontalAlign PopupHorizontalAlign { get; set; }
vb
<DefaultValue(PopupHorizontalAlign.NotSet)>
Public Property PopupHorizontalAlign As PopupHorizontalAlign

Property Value

TypeDefaultDescription
PopupHorizontalAlignNotSet

One of the PopupHorizontalAlign enumeration values.

|

Available values:

NameDescription
NotSet

A popup element is displayed on the x-coordinate of the mouse cursor position.

| | OutsideLeft |

A popup element is displayed to the left of the corresponding HTML element, so that the x-coordinate of the popup element’s right border is equal to the x-coordinate of the HTML element’s left border.

| | LeftSides |

A popup element is displayed so that its left border’s x-coordinate equals the x-coordinate of the corresponding HTML element’s left border.

| | Center |

A popup element is displayed so that the x-coordinate of the popup element’s center equals the x-coordinate of the corresponding HTML element’s center.

| | RightSides |

A popup element is displayed so that the x-coordinate of the popup element’s right border equals the x-coordinate of the corresponding HTML element’s right border.

| | OutsideRight |

A popup element is displayed to the right of the corresponding HTML element so that the x-coordinate of the popup element’s left border is equal to the x-coordinate of the HTML element’s right border.

| | WindowCenter |

A popup element is displayed so that it is horizontally aligned at the center of the browser’s window.

|

Remarks

The default popup window (or all popup windows from the ASPxPopupControl.Windows collection) is aligned horizontally on the x-coordinate of the mouse cursor position by default. Use the PopupHorizontalAlign property to set the window alignment relative to the corresponding element specified by the ASPxPopupControl.PopupElementID (PopupWindow.PopupElementID) property, or to display the window at the center of the browser’s window.

Note

Use the HorizontalAlign and VerticalAlign properties to align a popup in adaptive mode.

Example

This example demonstrates the following capabilities of the ASPxPopupControl when its popup window is used in modal mode:

  • The ShowPageScrollbarWhenModal property allows the browser’s vertical scrollbar to be displayed providing users with a capability to scroll the document content while the modal popup window is being shown;

  • The AutoUpdatePosition property controls whether the popup window’s position should be automatically recalculated after performing some popup window resizing or document scrolling operations.

  • Default.aspx

aspx
<dx:ASPxCheckBox ID="cbShowPageScrollbarWhenModal" runat="server" Text="ShowPageScrollbarWhenModal" />
<dx:ASPxCheckBox ID="cbAutoUpdatePosition" runat="server" Text="AutoUpdatePosition" />
<dx:ASPxButton ID="btnShow" runat="server" Text="Show" />

<dx:ASPxPopupControl ID="popup" runat="server" ShowOnPageLoad="true" PopupElementID="ASPxButton1" 
                     Modal="True" ShowPageScrollbarWhenModal="False" PopupHorizontalAlign="WindowCenter" 
                     PopupVerticalAlign="WindowCenter" HeaderText="Gladiator" AllowDragging="True" 
                     AllowResize="True" EnableAnimation="False">
    <ContentCollection>
        <dx:PopupControlContentControl runat="server">
            <span class="Gray"><b>Directed by:</b> Ridley Scott

                <b>Year:</b> 2000</span>

            

            <div style="font-family: Tahoma; font-size: 10px; color: #666666;">
                When a Roman general is betrayed and his family murdered by a corrupt prince, he
                comes to Rome as a gladiator to seek revenge.</div>
        </dx:PopupControlContentControl>
    </ContentCollection>
    <ClientSideEvents Init="function(s, e) { s.Show(); }" />
</dx:ASPxPopupControl>
csharp
protected void Page_Load(object sender, EventArgs e) {
    if(IsPostBack) {
        popup.ShowPageScrollbarWhenModal = cbShowPageScrollbarWhenModal.Checked;
        popup.AutoUpdatePosition = cbAutoUpdatePosition.Checked;
    }
}
vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    If IsPostBack Then
        popup.ShowPageScrollbarWhenModal = cbShowPageScrollbarWhenModal.Checked
        popup.AutoUpdatePosition = cbAutoUpdatePosition.Checked
    End If
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PopupHorizontalAlign 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-grid-delete-confirm-dialog-with-dont-ask-me-again-option/CS/Solution/Default.aspx.cs#L26

csharp
ASPxPopupControl1.PopupElementID = "ASPxGridView1";
ASPxPopupControl1.PopupHorizontalAlign = DevExpress.Web.PopupHorizontalAlign.Center;
ASPxPopupControl1.PopupVerticalAlign = DevExpress.Web.PopupVerticalAlign.Middle;

asp-net-web-forms-grid-delete-confirm-dialog-with-dont-ask-me-again-option/VB/Solution/Default.aspx.vb#L27

vb
ASPxPopupControl1.PopupElementID = "ASPxGridView1"
ASPxPopupControl1.PopupHorizontalAlign = DevExpress.Web.PopupHorizontalAlign.Center
ASPxPopupControl1.PopupVerticalAlign = DevExpress.Web.PopupVerticalAlign.Middle

See Also

PopupHorizontalOffset

ASPxPopupControl Class

ASPxPopupControl Members

DevExpress.Web Namespace