The QueryDataList control is inherited from the BasicDataList control. It automatically ensures data binding. Moreover, it allows you to specify its query, ORDER BY clause and WHERE condition and it displays data without any additional code.
QueryDataList can only be used with pre-defined queries stored in the document type configuration.
If you want to display data only from a particular part of the content tree, please use CMSDataList.
Data Source
Data retrieved using the predefined query specified in the QueryName property.
Inherits: CMSQueryProperties - 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.news.preview_alt" |
EnablePaging |
Enables paging and shows the DataPager control. |
|
PagerControl |
DataPager control that ensures paging. |
|
TransformationName |
Transformation name in format application.class.transformation. |
"cms.news.preview" |
Design
The design can be modified in the same way as for the standard ASP.NET DataList control. The design of the displayed content depends on used transformations.
Example
This example will show you how to read a list of the latest news and display them using the QueryDataList control.
• | Create a new Web form. |
• | Drag and drop the QueryDataList control on the form. |
• | In the Properties window set the following property values: |
- QueryName: cms.news.selectlatest
- RepeatColumns: 2
- TransformationName: cms.news.preview
• | Compile and run the project. You should see a page like this: |
Page url: http://devnet.kentico.com/docs/controls/index.html?querydatalist.htm