How to: Add Panel Web Server Controls to a Web Forms Page

To use a Panel Web server control, you add it to a page and then add controls and static text to it.

To add a Panel control to a Web Forms page

  1. Type an <asp:Panel> element into the page. For syntax, see Panel Web Server Control Declarative Syntax.

  2. Optionally, set the following properties of the Panel control to specify how the panel interacts with its child controls.

    Property Description

    HorizontalAlign

    Specifies how the child controls are aligned within the panel (left, right, centered, or justified).

    Wrap

    Specifies whether content that is too wide for the panel is wrapped to the next line or truncated at the panel's edge.

    ScrollBars

    Specifies whether the contents of the control are rendered left-to-right or right-to-left. This can be useful for creating areas on the page that have a different direction than the page as a whole.

    ScrollBars

    If you have set the Height and Width properties to constrain the Panel control to a specific size, you can add scrollbars by setting the ScrollBars property.

    GroupingText

    Renders a border and title around the Panel control.

    NoteNote
    Setting GroupingText causes scrollbars not to appear, if you have specified them

    For details about adding controls to the panel, see How to: Add Controls to an ASP.NET Web Page Programmatically.

See Also

Reference

Panel Web Server Control Overview