By default, the 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
Set the DataList control's property to the number of columns that you want.
Set the property to either or .
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.
Visual BasicВ Copy Code
DataList1.RepeatColumns = 2 DataList1.RepeatDirection = RepeatDirection.Horizontal
C#В Copy Code
DataList1.RepeatColumns = 2; DataList1.RepeatDirection = RepeatDirection.Horizontal;