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

Introduction to IE Data Binding - DHTML Lab | 2

Logo

Introduction to IE Data Binding



Example 1

The External Data File (StaffData.csv)

Dept:string,FirstName:string,LastName:string,Email:string,Telephone:string,Picture:string,About:string
Sales,Gareth,Cheeseman,gcheese@abusiness.com,018823654895,gc.jpg,Gareth is our top sales man
Sales,Bert,Russell,brussell@abusiness.com,018823654896,none.jpg, Bert backs up Gareth on tricky sales
Support,Ernest,Chipset,echipset@abusiness.com,01882365487,none.jpg,Ernest provides after sales support
Support,Dilbert,Gantry,dgantry@abusiness.com,01882365488,none.jpg,Dilbert is fast learning the support trade
Technical,Shawn,FrontBus,sfrontbus@abusiness.com,01882365490,none.jpg,Shawn is our technical Guru
Technical,Roger,Ecma,recma@abusiness.com,01882365491,none.jpg,Roger is our programming expert

The HTML Page

<HTML>
<HEAD>
<TITLE>IE DHTML Data Binding Example 1</TITLE>
<STYLE>
TD {COLOR: white}
LABEL {FONT-WEIGHT: bold}
</STYLE>
<SCRIPT LANGUAGE='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>
</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>
<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>Name:</TD><TD NOWRAP><SPAN DATASRC="#tdcStaff" DATAFLD="FirstName"></SPAN> <SPAN DATASRC="#tdcStaff" DATAFLD="LastName"></SPAN></TD>
            </TR>
            <TR>
               <TD> </TD>
            </TR>
            <TR BGCOLOR='#004A8C'>
               <TD>Email:</TD><TD><DIV DATASRC="#tdcStaff" DATAFLD="Email"></DIV></TD>
            </TR>
            <TR>
               <TD> </TD>
            </TR>
            <TR BGCOLOR='#004A8C'>
               <TD>Tel:</TD><TD><DIV DATASRC="#tdcStaff" DATAFLD="Telephone"></DIV></TD>
            </TR>
            <TR>
               <TD> </TD>
            </TR>
            <TR BGCOLOR='#004A8C'>
               <TD>About:</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>Dept:<SPAN DATASRC="#tdcStaff" DATAFLD="Dept"></SPAN></TD>
   </TR>
</TABLE>
</BODY>
</HTML>

And finally, here is a repeat of Example 2.


Produced by Ian McArdle and Paul Thomas and

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

URL: http://www.webreference.com/dhtml/column39/10.html