QueryDataList

The QueryDataList control is inherited from the BasicDataList control. It automatically ensures data binding. Moreover, it allows you to specify query, ORDER BY clause and the WHERE condition and it ensures displaying data without any additional code.

 

QueryDataList can be used only with pre-defined queries stored in the document type configuration.

 

If you want to display data only from 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 show the DataPager control.


PagerControl

DataPager control.


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:

 

clip0027