Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Specify Horizontal or Vertical Layout in DataList Web Server Controls 

By default, the DataList Web server control displays a single column. However, you can specify any number of columns. Within the columns, you can specify how the items are ordered: vertically (which is the default) or horizontally. Vertical layout in three columns results in a layout such as the following:

1    4    7
2    5    8
3    6

Horizontal layout for the same items results in the following layout:

1    2    3
4    5    6
7    8

To specify column count and ordering at design time

  1. Set the DataList control's RepeatColumns property to the number of columns that you want.

  2. Set the RepeatDirection property to either Vertical or Horizontal.

To specify column count and ordering programmatically

  • Specify the number of columns that want by using the RepeatColumns property, and then specify how you want the items in the columns to be ordered by using the RepeatDirection enumeration, as shown in the following code example.

    DataList1.RepeatColumns = 2
    DataList1.RepeatDirection = RepeatDirection.Horizontal

    DataList1.RepeatColumns = 2;
    DataList1.RepeatDirection = RepeatDirection.Horizontal;

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.