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

Introduction to IE Data Binding - DHTML Lab | 8

Logo

Introduction to IE Data Binding



A Working Example

 
 
 
 

The above example displays just a single record. How do you view the other records? As you can see there are four buttons at bottom left. These allow us to move from record to record. The code used for the navigation buttons will be explained on the next page, but first here is the complete code necessary for our example:

<HTML>
<HEAD>
<TITLE></TITLE>
<STYLE TYPE="text/css">
    TD {COLOR: white}
    LABEL {FONT-WEIGHT: bold}
</STYLE>
</HEAD>
<BODY>
<OBJECT ID="tdcStaff"
        CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
    <PARAM NAME="DataURL" VALUE="StaffData.csv"> 
    <PARAM NAME="UseHeader" VALUE="True">
    <PARAM NAME="TextQualifier" VALUE=",">
</OBJECT>
<SCRIPT LANGUAGE='Javascript' TYPE="text/javascript">
function moveNext()
{
    tdcStaff.recordset.MoveNext();
    if(tdcStaff.recordset.eof)
    {    
        tdcStaff.recordset.MoveFirst();
    }
}
function movePrevious()
{
    tdcStaff.recordset.MovePrevious();
    if(tdcStaff.recordset.bof)
    {    
        tdcStaff.recordset.MoveLast();
    }
}
</SCRIPT>
<TABLE BORDER=2 CELLPADDING=0 CELLSPACING=0>
   <TR BGCOLOR='#004A8C'>
      <TD><IMG DATASRC="#tdcStaff" DATAFLD="Picture">
      </TD>
      <TD VALIGN=TOP>
         <TABLE CELLPADDING=0 CELLSPACING=0 BGCOLOR='8086F6' HEIGHT='100%'>
            <TR BGCOLOR='#004A8C'>
               <TD><LABEL>Name:</LABEL></TD>
               <TD NOWRAP><SPAN DATASRC="#tdcStaff" DATAFLD="FirstName"></SPAN>
               &nbsp;<SPAN DATASRC="#tdcStaff" DATAFLD="LastName"></SPAN></TD>
            </TR>
            <TR>
                <TD>&nbsp;</TD>
            </TR>
            <TR BGCOLOR='#004A8C'>
                <TD><LABEL>Email:</LABEL></TD>
                <TD><DIV DATASRC="#tdcStaff" DATAFLD="Email"></DIV></TD>
            </TR>
            <TR>
                <TD>&nbsp;</TD>
            </TR>
            <TR BGCOLOR='#004A8C'>
                <TD><LABEL>Tel:</LABEL></TD>
                <TD><DIV DATASRC="#tdcStaff" DATAFLD="Telephone"></DIV></TD>
            </TR>
            <TR>
                <TD>&nbsp;</TD>
            </TR>
            <TR BGCOLOR='#004A8C'>
                <TD><LABEL>About:</LABEL></TD>
                <TD><DIV DATASRC="#tdcStaff" DATAFLD="About"></DIV></TD>
                </TR>
            </TABLE>
        </TD>
    </TR>
    <TR BGCOLOR='#004A8C'>
        <TD><INPUT TYPE="BUTTON" ONCLICK="tdcStaff.recordset.MoveFirst();" VALUE=" << " ALT="Move First">
            <INPUT TYPE="BUTTON" ONCLICK="movePrevious();" VALUE=" < " ALT="Back">
            <INPUT TYPE="BUTTON" ONCLICK="moveNext();" VALUE=" > " ALT="Next">
            <INPUT TYPE="BUTTON" ONCLICK="tdcStaff.recordset.MoveLast();" VALUE=" >> " ALT="Move Last"></TD>
        <TD><LABEL>Dept:</LABEL><SPAN DATASRC="#tdcStaff" DATAFLD="Dept"></SPAN></TD>
    </TR>
</TABLE>
</BODY>
</HTML>

Let's look at record navigation.


Produced by Ian McArdle and Paul Thomas and

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

URL: https://www.webreference.com/dhtml/column39/6.html