Introduction to IE Data Binding - DHTML Lab | 10 | WebReference

Introduction to IE Data Binding - DHTML Lab | 10


Introduction to IE Data Binding

Tabular Data Consumer

First Name Last Name Telephone Email

The following HTML fragment, taken from the example above, shows how a table, or more specifically a tabular data consumer (TDC), can be bound to a data source object (DSO).

<TABLE DATASRC="#tdcStaff">
    <TR BGCOLOR=#333366>
      <TH><FONT COLOR=#FFFFFF>First Name</FONT></TH>
      <TH><FONT COLOR=#FFFFFF>Last Name</FONT></TH>
      <TH><FONT COLOR=#FFFFFF>Telephone</FONT></TH>
      <TD><DIV datafld=FirstName></DIV></TD>
      <TD><DIV datafld=LastName></DIV></TD>
      <TD><DIV datafld=Telephone></DIV></TD>
      <TD><A DATAFLD=Email></A></TD>
      <TD COLSPAN=4>
        <SELECT NAME='cboDept' STYLE="WIDTH=150" ONCHANGE='selectChange();'>

Behind the scenes, a repetition agent uses the table row <TR> inside the table body as a template. Note the use of the <THEAD> and <TFOOT> tags to insert rows that are ignored by the repetition agent.

We re-use the DSO identified in the first example, tdcStaff. This supplies each record in the dataset to the repetition agent, which uses the template <DIV>'s to generate all the rows until all the staff names, telephone numbers and e-mail addresses are displayed.

It is when using tabular data consumers that the final attribute mentioned above, DATAPAGESIZE, may be applied. This specifies how many rows of data are to be displayed in the <TABLE> at a time. We could implement paging (showing a subset of all the records) using the Move() (move relative to current record) and MoveAbsolute() (move relative to first record) methods exposed by the recordset of the DSO, as in the previous section.

As discussed in the initial phone bill scenario, sorting and filtering data is yet another feature of Data Binding that can be used with the display of data. This is discussed on the next page.

Produced by Ian McArdle and Paul Thomas and

All Rights Reserved. Legal Notices.
Created: Oct 17, 2000
Revised: Oct 17, 2000