Controls You Can Use on Web Forms ASP.NET Data Controls DataList Control
By default, the DataList displays a single column in which the contents are rendered in a top to bottom sequence.
The DataList, though, includes a RepeatColumns property that can be set to render the list items in any number of columns, and a RepeatDirection property that can be set to render the items in either vertical or horizontal order.
For instance, speciying three columns with repeat direction set to Horizontal renders a list of items shown below:
Vertical layout for the same items results in the following:
- Include the RepeatColumns and RepeatDirection property within the opening tag of the DataList control.
<asp:datalist id="myList" runat="server"
repeatcolumns=3 repeatdirection="horizontal">
- If you are setting the property in code, use the RepeatDirection enumeration, as shown below.
myList.RepeatDirection = RepeatDirection.Horizontal;
NOTE: When not specified, RepeatDirection defaults to Vertical.
Adding DataList Controls to a Web Forms Page Specifying List Layout in a DataList Control
|