Visual InterDev
Creates a Label script object, which creates a string of text (bracketed by the <SPAN> tag) that is bound to data.
Remarks
You can set the properties of the Label control at design time using the Properties window and the Label Properties dialog box.
You can use the Label control to display data from a database as read-only text on a page. The settings on the Format tab of the Label Properties dialog box determine how the text is formatted. For example, you can select a particular font, size, and color.
The Label control creates text that is not interactive; it creates text that is read from - but cannot be written to - a database. To create interactive text that can be written to a database, use the Textbox control.
To bind the Label to a recordset, set the Recordset property to one of the Recordset design-time controls that is on the page. Set the DataField property to the name of the field that you want to bind. You can also use an expression instead of a field.
Note The scripting platform specifies where an object's script is run - either on the client (Microsoft® Internet Explorer 4.0 DHTML) or on the server (ASP). Thus, the scripting platform determines whether the object is available under Client Objects & Events or Server Objects & Events in the Script Outline window.
For the Label control, the Scripting Platform property is specified on the General tab of the Label Properties dialog box. For more information, see the DTCScriptingPlatform property. For detailed information about choosing a scripting platform, see Writing Script for Script Objects.
Rules for expressions
The Field/Expression property on the General tab of the Label Properties dialog box supports expressions. A string that begins with an equal sign ( = ) indicates that it is an expression. An expression can be built from any combination of strings, fields, and functions in order to produce a string that will be written to the page.
[ ]
are placed around a field name to return the field's value.
The following example combines HTML formatting and a field named First Name
.
="<B><I>" + [First Name] + "</B></I>"
If the value of First Name
in the current record is "Shiniqua", the expression would produce the following on the client browser:
Shiniqua
Scripting Notes
The Label script object inserts a <SPAN> tag into the text stream of the document. The Label script object includes text with the <SPAN> tag that is based on the Label design-time control's Caption and formatting properties.
Call the hide, show, and isVisible methods to control how the button is displayed.
To manipulate the text of the Label, call the getCaption and setCaption methods.
For more information about the run-time object, see Label Script Object. For information on scripting and objects, see Scripting with Design-Time Controls and Script Objects.