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>]
type ScrollBars

Member nameDescription
Auto

Displays, horizontal, vertical, or both scroll bars as necessary. Otherwise, no scroll bars are shown.

Both

Displays both a horizontal and a vertical scroll bar.

Horizontal

Displays only a horizontal scroll bar.

None

Displays no scroll bars.

Vertical

Displays only a vertical scroll bar.

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.

.NET Framework
Available since 2.0
Return to top
Show: