Skip to main content
Tab

ASPxPanel Class

Represents a panel control that acts as a container for other controls.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public class ASPxPanel :
    ASPxCollapsiblePanel

Remarks

The ASPxPanel control is a container area for other controls. It is useful when you want to generate controls programmatically, hide/show a group of controls, etc. You can populate the ASPxPanel with other controls using the ASPxPanelContainerBase.Controls property and the PanelContent control.

Create a Panel

Design Time

The ASPxPanel control is available on the DX.24.2: Navigation & Layout toolbox tab in the Microsoft Visual Studio IDE.

Drag the control onto a form and customize the control’s settings, or paste the control markup in the page’s source code.

<dx:ASPxPanel ID="TopPanel" runat="server" Collapsible="true" 
              FixedPosition="WindowTop" ClientInstanceName="ClientPanel">
    <SettingsAdaptivity CollapseAtWindowInnerWidth="624" />
    <PanelCollection>
        <dx:PanelContent runat="server">
            <dx:ASPxMenu ID="HeaderMenu" runat="server">
                <Items>
                    <dx:MenuItem Text="Data"></dx:MenuItem>
                    <dx:MenuItem Text="Settings"></dx:MenuItem>
                    <dx:MenuItem Text="Profile"></dx:MenuItem>
                    <dx:MenuItem Text="Help"></dx:MenuItem>
                </Items>
            </dx:ASPxMenu>
        </dx:PanelContent>
    </PanelCollection>
</dx:ASPxPanel>

Run Time

using DevExpress.Web;
using MenuItem = DevExpress.Web.MenuItem;
...
protected void Page_Load(object sender, EventArgs e) {
    ASPxPanel panel = new ASPxPanel();
    panel.ID = "TopPanel";
    panel.ClientInstanceName = "ClientPanel";
    panel.FixedPosition = PanelFixedPosition.WindowTop;
    panel.Collapsible = true;
    panel.SettingsAdaptivity.CollapseAtWindowInnerWidth = 624;

    ASPxMenu menu = new ASPxMenu();
    menu.ID = "HeaderMenu";
    menu.Items.AddRange(new List<MenuItem>() {
        new MenuItem("Data"),
        new MenuItem("Settings"),
        new MenuItem("Profile"),
        new MenuItem("Help")
    });

    panel.Controls.Add(menu);
    Page.Form.Controls.Add(panel);
}

Note

DevExpress controls require that you register special modules, handlers, and options in the Web.config file. You can change this file or switch to the Design tab in the Microsoft Visual Studio IDE to automatically update the Web.config file. Note that this information is automatically registered if you use the DevExpress Template Gallery to create a project.

The ASPxPanel control inherits all its functionality from the base ASPxPanelBase class. This functionality enables the panel’s child controls to be manipulated (ASPxPanelContainerBase.Controls), the panel’s default button to be specified (ASPxPanelBase.DefaultButton), the panel’s initial visibility on the client to be defined (ASPxPanelBase.ClientVisible) etc. In addition, the ASPxPanel class implements the ASPxCollapsiblePanel.RenderMode property that allows you to specify how the panel should be rendered into the page.

Note

The ASPxPanel control provides you with a comprehensive client-side functionality implemented using JavaScript code:

The control’s client-side API is enabled if the ASPxCollapsiblePanel.EnableClientSideAPI property is set to true, or the ASPxPanelBase.ClientInstanceName property is defined, or any client event is handled.

See Also