<xmod:DataList>

The DataList tag, like the Template tag, is a View control that is used for displaying and interacting with records from your datasource. It is used in essentially the same manner as the Template tag and can be used together with the Template tag within your templates. Like the Template tag, it contains the data commands and layout instructions for your display and enables you to specify who is allowed to add, edit, and delete records as well as who is allowed to view the details of records. The primary difference between the DataList and Template is that the DataList allows you to layout your records in a grid pattern.

Record1 Record2 Record3
Record4 Record5 Record6
Record7 Record8 ----- OR ---- Record1 Record4 Record7 Record2 Record5 Record8 Record3 Record6

This type of layout is handy for scenarios like displaying a list of images or products where you want to control the specific number of columns and the order in which they're displayed.

You can use multiple DataList tags, enabling you to have side-by-side (or however you want to lay them out using HTML) displays within the same module instance, each being fed by different datasources.

Syntax

<xmod:DataList
    AddRoles="DNNRoleName1,DNNRoleName2"
    Ajax="True|False"
    ConnectionString="string"
    DeleteRoles="DNNRoleName1;DNNRoleName2"

    DetailRoles="DNNRoleName1;DNNRoleName2"
    EditRoles="DNNRoleName1;DNNRoleName2"

    ID="string"
    RepeatColumns="integer"
    RepeatDirection="Horizontal|Vertical"
    RepeatLayout="Table|Flow"
    UsePaging="True|False">


    <ListDataSource CommandText="string"
        ConnectionString="string"/>

    <DetailDataSource CommandText="string"
        ConnectionString="string"/>

    <DeleteCommand CommandText="string" />


<Pager> ... </Pager>
<SearchSort>...</SearchSort>


    <HeaderTemplate>...</HeaderTemplate>
    <ItemTemplate>...</ItemTemplate>
    <AlternatingItemTemplate>...</AlternatingItemTemplate>
    <SeparatorTemplate>...</SeparatorTemplate>

    <FooterTemplate>...</FooterTemplate>

    <DetailTemplate>...</DetailTemplate>

    <NoItemsTemplate>...</NoItemsTemplate>

</xmod:DataList>

Remarks

Back to top

Example

<xmod:DataList AddRoles="SampleRole1;SampleRole2">
    <ListDataSource commandtext="SELECT * FROM Users" />
    <DetailDataSource commandtext="SELECT * FROM Users WHERE UserID=@UserID" />
    <HeaderTemplate>
        <h1>Users List</h1>
    </HeaderTemplate>
    <ItemTemplate>
            User's Name: [[FirstName]] [[LastName]] <br />
            <xmod:detaillink text="More...">
                <parameter name="UserID" value='[[UserID]]' />
            </xmod:detaillink>
    </ItemTemplate>
    <AlternatingItemTemplate>
            User's Name: [[FirstName]] [[LastName]] <br />
            <xmod:detaillink text="More...">
                <parameter name="UserID" value='[[UserID]]' />
            </xmod:detaillink>
    </AlternatingItemTemplate>
    <FooterTemplate>
       
    </FooterTemplate>
    <DetailTemplate>
        <h1>This is the detail view</h1>
        User's Name: [[FirstName]] [[LastName]]
    </DetailTemplate>
    <NoItemsTemplate>
      <span class="NormalRed">Sorry. No Records Were Found</span>
    </NoItemsTemplate>

</xmod:DataList>
Back to top