Visual InterDev
Creates a Checkbox script object, which creates an intrinsic HTML check box that can be bound to data.
Remarks
You can set the properties of the Checkbox control at design time using the Properties window and the Checkbox Properties dialog box.
The Checkbox control can be used for displaying and writing Boolean data to a database. The control is bound to data by the Recordset and DataField properties. The Recordset property specifies a Recordset design-time control that exists on the page.
To display text next to the check box, use the Caption property.
By default, a Checkbox control is created when you drag a field, whose data type is Boolean or Bit, from a Data Environment object in the Project Explorer onto a page. (For all other data types, the default is a Textbox control)
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 Checkbox control, the Scripting Platform property is specified on the General tab of the Checkbox Properties dialog box. For more information, see the DTCScriptingPlatform property. For detailed information about choosing a scripting platform, see Writing Script for Script Objects.
Scripting Notes
Call the getChecked and setChecked properties to control the state of the check box. Call getCaption and setCaption to control the text that appears next to the check box. For more information about the run-time object, see Checkbox Script Object.
The checkbox setting that is displayed in the browser depends on the data type of the Recordset control's DataField property. The following table illustrates whether the check box is checked when viewed by the user in the browser.
Data displayed in Checkbox control
Data type of DataField | Checked | Cleared |
Boolean | True | False |
Bit | 1 | 0 |
String, Char | "True" | "" |
Integer | Non-zero | 0 |
Floating Point | Non-zero | 0 |
Currency | Non-zero | 0 |
Date/Time | N/A | N/A |
All other data types | N/A | N/A |
The value that is written to the recordset depends on the DataField property's data type and the user's input. The following table illustrates how values are written to the recordset when the form is submitted.
Data written from Checkbox control
Data type | Checked | Cleared |
Boolean | True | False |
Bit | 1 | 0 |
String, Char | "True" | "" |
Integer | -1 | 0 |
Floating Point | -1.0 | 0.0 |
Currency | -1 | 00.0 |
Date/Time | N/A | N/A |
All other data types | N/A | N/A |
For more information about the run-time object, see Checkbox Script Object. For information on scripting and objects, see Scripting with Design-Time Controls and Script Objects.