Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

ScrollBars Enumeration

Specifies the visibility and position of scroll bars in a Panel control.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[FlagsAttribute]
public enum class ScrollBars

Member nameDescription
NoneDisplays no scroll bars.
HorizontalDisplays only a horizontal scroll bar.
VerticalDisplays only a vertical scroll bar.
BothDisplays both a horizontal and a vertical scroll bar.
AutoDisplays, horizontal, vertical, or both scroll bars as necessary. Otherwise, no scroll bars are shown.

The ScrollBars enumeration represents the visibility and position of the scroll bars in a Panel control. The ScrollBars property uses these enumeration values to specify the type of scroll bars to display in a Panel control. The default value for the ScrollBars property is None, indicating that no scroll bars are shown.

If you specify Auto for the ScrollBars property, scroll bars are automatically shown when the size of the content in a Panel control exceeds the size of the Panel control. For example, if a Panel control contains a table, and the panel is not wide enough to display all the rows in the table, a vertical scroll bar is shown. If the size of the table exceeds the height and width of the panel, both vertical and horizontal scroll bars are shown.

The following code example demonstrates how to declaratively set the ScrollBars property to Auto. The panel contains a table, the entire contents of which exceed the size of the panel. This causes both vertical and horizontal scroll bars to be automatically displayed when the panel is rendered. The user can then scroll to view all the data in the table.

No code example is currently available or this language may not be supported.

The following code example demonstrates the ScrollBars enumeration values. A ListBox control is populated with the ScrollBars enumeration values. The scroll bars displayed in the panel change, based on the value the user selects from the list box.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft