JavaScript Editor jscript editor     Web designer 



Main Page

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:

В CopyCode imageCopy Code
1    4    7
2    5    8
3    6

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

В CopyCode imageCopy Code
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.

    Visual BasicВ CopyCode imageCopy Code
    DataList1.RepeatColumns = 2
    DataList1.RepeatDirection = RepeatDirection.Horizontal

    C#В CopyCode imageCopy Code
    DataList1.RepeatColumns = 2;
    DataList1.RepeatDirection = RepeatDirection.Horizontal;

See Also



JavaScript Editor jscript editor     Web designer