Back to Devexpress

ASPxPanel Class

aspnet-devexpress-dot-web-2edc8306.md

latest7.8 KB
Original Source

ASPxPanel Class

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

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class ASPxPanel :
    ASPxCollapsiblePanel
vb
Public Class ASPxPanel
    Inherits 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.25.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.

aspx
<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

csharp
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);
}
vb
Imports DevExpress.Web
Imports MenuItem = DevExpress.Web.MenuItem
...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim panel As ASPxPanel = New ASPxPanel()
    panel.ID = "TopPanel"
    panel.ClientInstanceName = "ClientPanel"
    panel.FixedPosition = PanelFixedPosition.WindowTop
    panel.Collapsible = True
    panel.SettingsAdaptivity.CollapseAtWindowInnerWidth = 624

    Dim menu As ASPxMenu = New ASPxMenu()
    menu.ID = "HeaderMenu"
    menu.Items.AddRange(New List(Of MenuItem)() From {
        New MenuItem("Data"),
        New MenuItem("Settings"),
        New MenuItem("Profile"),
        New MenuItem("Help")
    })

    panel.Controls.Add(menu)
    Page.Form.Controls.Add(panel)
End Sub

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.

Implements

Show 14 items

IComponent

IDisposable

IParserAccessor

IDataBindingsAccessor

IControlBuilderAccessor

IControlDesignerAccessor

IExpressionsAccessor

IAttributeAccessor

IUrlResolutionService

INamingContainer

IPostBackDataHandler

IPostBackEventHandler

ICallbackEventHandler

IPropertiesOwner

Inheritance

Object Control WebControl ASPxWebControlBase ASPxWebControl ASPxPanelContainerBase ASPxPanelBase ASPxCollapsiblePanel ASPxPanel MVCxPanel

See Also

ASPxPanel Members

Panel

DevExpress.Web Namespace