<xmod:Each>

The Each tag (new to version 4.6) is used to split a delimited value - such as a comma-separated or pipe-separated value in your database. You can then iterate through each of these values, rendering out HTML. In otherwords, if you have a list of images stored in an Images column in your table, you can build a bullet list from that.

NOTE: The Each tag is designed to render text and HTML. It will not render other XMod Pro tags.

Syntax

<xmod:Each
    Delimiter="string - defaults to pipe ( | ) character"
    Value="string">

    <FirstItemTemplate>...Text, HTML, {index}, {count}, {value}...</FirstItemTemplate>
    <ItemTemplate>...Text, HTML, {index}, {count}, {value}...</ItemTemplate>
    <AlternatingItemTemplate>...Text, HTML, {index}, {count}, {value}...</AlternatingItemTemplate>
    <LastItemTemplate>...Text, HTML, {index}, {count}, {value}...</LastItemTemplate>
    <SeparatorTemplate>...Text, HTML{index}, {count}, {value}...</SeparatorTemplate>
</xmod:MetaTags>

Remarks

Back to top

Example

<div>
  <table width="100%">
    <tr>
      <td width="250" valign="top">

        <!-- EMPLOYEES TEMPLATE -->

        <xmod:Template Id="Employees">
          <DetailDatasource commandtext="SELECT * FROM XMPDemo_Employees WHERE EmployeeId = @EmpID">
            <Parameter Name="EmployeeId" Value='[[Url:eid]]' DataType="Int32" />
          </DetailDatasource>

          <DetailTemplate>
            <h1>Employee Profile</h1>
            <h3>[[FirstName]] [[LastName]]</h3>
            <h4>Biography:</h4>
            <h6>Images</h6
           <ul>
              <xmod:Each Delimiter="|" Value='[[Images]]'>
                <ItemTemplate><img src="/img/{value}" /></ItemTemplate>
              </xmod:Each>
            </ul>
          </DetailTemplate>
        </xmod:Template>
      </td>
    </tr>
  </table>
</div>
Back to top