Introduction to IE Data Binding - DHTML Lab | 9
Introduction to IE Data Binding
Changing the Current Record
In order to view the other records we need to utilise the recordset property exposed by the DSO. The recordset object itself exposes four more methods that we can use in navigation. The methods are fairly self-explanatory:
- MoveFirst()
- Makes the first record of the dataset the current record.
- MoveLast()
- Makes the last record the current record.
- MoveNext()
- Makes the next record the current record.
- MovePrevious()
- Makes the previous record the current record.
In our example, the code for moving to the beginning and end of the recordset is inline for brevity:
<INPUT TYPE="BUTTON" ONCLICK="tdcStaff.recordset.MoveFirst();" VALUE=" << ">
However, moving to the next and previous records is performed in functions, as we must implement wrapping when the start or end of the recordset is passed. We can detect when end of the recordset is reached as the recordset property eof is set to true.
function moveNext() { tdcStaff.recordset.MoveNext(); if(tdcStaff.recordset.eof) { tdcStaff.recordset.MoveFirst(); } }
Bindable HTML elements fall into two categories, single valued and tabular data consumers. In our first example, all of the data bound HTML elements fall into the category of single valued data consumers, as they require the combination of a DATASRC and a DATAFLD attribute to bind a column of a single record.
The <TABLE> element is slightly exceptional as it falls into the category of tabular data consumers, since it only requires a DATASRC. Tabular data consumers rely on the elements that they contain to bind to data columns from the DSO. We will develop another example to illustrate this 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
URL: https://www.webreference.com/dhtml/column39/7.html