dataselect Behavior

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

Adds databinding capabilities to the select element.

Syntax

XML N/A
HTML <SELECT STYLE="behavior:url('dataselect.htc')">
Scripting object .style.behavior = "url('dataselect.htc')"
object .addBehavior ("dataselect.htc")

Members Table

The following table lists the members exposed by the dataselect object.

Attributes/Properties
Attribute Property Description
DATAFLDTEXT dataFldText Sets or retrieves the name of the field used for the visible text of the dataselect behavior options.
DATAFLDVALUE dataFldValue Sets or retrieves the name of the field used for the value of the dataselect behavior options.
DATASRC dataSrc Sets or retrieves the source of the data for the dataselect behavior.
VALUE value Sets or retrieves the initial selected option in the dataselect behavior.
Events
Event Property Description
ondatasetcomplete Fires when the dataselect behavior populates the contents of a select element.

Remarks

The behavior-defined members listed in the preceding table are not accessible through script until the window. onload event fires. Waiting for this event to fire ensures that the page is completely loaded, that all behaviors have been applied to corresponding elements on the page, and, consequently, that all the behavior's properties, methods, and events are available for scripting. Attempting to use any of the behavior-defined members will result in a scripting error indicating that the object does not support that particular member.

A data source object must be instantiated for the dataselect behavior to work. To learn more about data source objects, read the Introduction to Data Binding overview. The sample included on this page provides the necessary code to instantiate a data source object.

The dataselect.htc file can be downloaded from the dataselect  sample page.

Example

This sample demonstrates the implementation of the dataselect behavior to bind a text file to a select element.


<HEAD>
<STYLE>
.bound{behavior: url("DataSelect.htc")}
H1{font: bold 18pt verdana; color: navy;}
P{font: 10pt verdana;}
</STYLE>
</HEAD>
<BODY>
<SELECT NAME="oTest"
   CLASS="bound"
   DATASRC="#oData"
   VALUE="4a"
   DATAFLDTEXT="column2"
   DATAFLDVALUE="column1"
</SELECT>
<!-- Data source object must be present -->
<OBJECT ID="oData" CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
   <PARAM NAME="DataURL" VALUE="dataselect.txt">
   <PARAM NAME="FieldDelim" VALUE=",">
</OBJECT>
</BODY>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/library/dataselect/dataselect.htm

Applies To

SELECT

See Also

Community Additions

Show: