Table of Records

This example displays a table of records from the database.  Each record is displayed in its own row.  This example illustrates:

  1. How the Table code generation tag can be used to display a table of records.

  2. How the ItemTemplate tag can be used to specify the layout of each row.

  3. How the FieldValue tags can be used within the ItemTemplate tag to display fields from the table.

Description

Attribute

Description

Layout Page File

TableDisplay.html

Properties File

TableDisplay.xml

Code Generation Tags Used

GEN:Table, GEN:ItemTemplate and GEN:FieldValue

Generated Page

Layout Page File

 

     <div align="center">

          <GEN:Table Name="Products">

          <table cellpadding="5" style="border-collapse: collapse" border="1"

                        bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0">

              <GEN:ItemTemplate>

              <tr style="font-family:Verdana; font-size:10px">

                   <td>

                        <GEN:FieldValue Name="ProductId" />

                   </td>

                   <td>

                        <GEN:FieldValue Name="ProductName" />

                   </td>

                   <td>

                        <GEN:FieldValue Name="UnitPrice" />

                   </td>

                   <td>

                        <GEN:FieldValue Name="UnitsInStock" />

                   </td>

                   <td>

                        <GEN:FieldValue Name="Discontinued" />

                   </td>

              </tr>

              </GEN:ItemTemplate>

          </table>

          </GEN:Table>

     </div>

Procedure

Step 1:  Set the data binding properties for the Products tag.

Tag Property

Setting

Code generation tag

Products

Table, view or query

Products

Default table size

20

Step 2:  Set the data binding properties for the FieldValue tags as they were set in earlier examples.

Step 3:  Build the application.

Step 4:  Open a new browser and enter this URL to display the page:

http://localhost/Tutorial/Tutorial%20Pages/TableDisplay.aspx

There is no need to specify a query string parameter since all of the products from a table are being displayed instead of a specific table.