The CMSDataList control is inherited from the BasicDataList control.
It allows you to display part of the CMS content specified by its path, depth, document template, WHERE condition and ORDER BY clause. The CMSDataList control displays content without writing any additional code. Unlike CMSRepeater, the CMSDataList control allows you to display content in several columns.
Please note: If you want to display data using a custom query, please use the QueryDataList control.
Data Source
Data retrieved using the SelectDocuments query of the specified document template.
Inherits: CMSDataProperties - common properties, BasicDataList
See also: DataPager
Properties
Property Name |
Description |
Sample Value |
AlternatingTransformationName |
Transformation name in format application.class.transformation applied to alternating items. |
"cms.product.alternatepreview" |
EnablePaging |
Enables paging. |
|
PagerControl |
Represents pager control. See DataPager for more details. |
|
TransformationName |
Transformation name in format application.class.transformation. |
"cms.product.preview" |
NestedControlsID |
IDs of the nested controls (CMSRepeater, CMSDataList), separated by semicolons. |
"CMSRepeaterNested;CMSDataListNested" |
Please note: you can find an example of datalist/repeater nesting in CMSRepeater chapter.
Design
The design can be modified in the same way as for the standard ASP.NET DataList control and by the transformations defined in the AlternatingTransformationName, TransformationName and SelectedItemTransformationName properties.
Example
This example will show you how to read a list of documents and display it using the repeater.
1. | Create a new Web form. |
2. | Drag and drop the CMSDataList control on the form. |
3. | In the Properties window set the following property values: |
- ClassNames: cms.product
- MaxRelativeLevel: -1
- OrderBy: ProductName
- Path: /products/%
- RepeatColumns: 2
- TransformationName: cms.product.preview
- SelectedItemTransformationName: cms.product.default
Please note: as you defined TransformationName property, it's not necessary to define the standard ItemTemplate element of the DataList control.
4. | Compile and run the project. You should see a page like this:![]() |
Page url: http://devnet.kentico.com/docs/controls/index.html?cmsdatalist.htm