CodeCharge Studio All ASP PHP Perl ColdFusion Java C#.NET VB.NET

CheckBox List Control Reference

Design-Time Properties

Property Description
Name The name of the control.
Caption The name used to refer to the control in an error message.
Control Source Type The type of data source that will provide data for the control: Database Column, Code Expression.
Control Source Specify the source of data for the control.
Connection The database connection from where data will be retrieved.
List Source Type Specify the type of data source for the list of values to be shown in the control.
List Data Source Specify the actual data source for the list of values to appear in the control. The value entered here depends on the List Source Type property.
Bound Column When using database columns as the data source, specify the column containing the values that will be submitted.
Text Column When using database columns as the data source, specify the column containing the values that will be displayed.
Data Type The type of data that will be contained in the control.
Default Value Specify a default value to be used for the control if no value is otherwise specified.
Content Specify whether the data source content is plain text or HTML code.
Required [Yes/No] Select ‘Yes’ if a value must be entered for the control in order for the form to be submitted successfully.
Unique [Yes/No] Select ‘Yes’ if you want a check to be made to ensure that any value entered in the control does not already exist in the database.
Error Control Specify the name of a control that will be used to display any error messages pertaining to the control. If this value is not specified, all error messages are displayed at the top of the form in which the control is contained.
Validation Rule Specify an expression that will be used to check the validity of the data entered in the control.
Validation Text Specify the text that will be displayed if the data entered in the control does not satisfy the validation rule.

Events

Event Description
Server Side Events
On Validate This event occurs after standard validation operations have been performed as a result of submitting values, but before any database operations have been performed with the submitted values.
Before Show This event occurs before a component is rendered to the page.
Before Build Select This event occurs before the query that will be used to retrieve records from the database is put together. This event can be used to modify the different clauses that make up the query such as the WHERE clause or the ORDER BY clause.
Before Execute Select This event occurs immediately before a row selection query is executed but after the query has been composed. This event can be used to modify the entire query before it is executed.
After Execute Select This event occurs after the row selection query has been executed and a recordset containing the results is returned.
Client Side Events
On Click Occurs immediately after the control has been clicked. This event can be used to provide interactive behavior when the control is clicked.

Run-Time Properties (ASP)

Property Description
DataSource A Data Source object created for the purpose of retrieving and holding the IDs and values to be displayed in the control.
Errors This property keeps a reference to the object’s error collection. It is used to collect error messages generated during the object’s execution.
Value This property stores the first selected checkbox value.
Visible This property controls the visibility of the control. If the property is set to false, the control will not be displayed.

Data Source properties

Property Description
DataSource.SQL  This property contains the main portion of the SQL query used to retrieve the records displayed within the control . In terms of SQL, this property defines the SELECT and FROM clauses of the SQL query.
DataSource.Where  This property contains the WHERE clause portion of the SQL query used to retrieve records for the control. The WHERE clause provides the criteria which filters the records retrieved. The value of this property is appended to the value of the DataSource.SQL  property to create the final SQL query which is executed against the datasource to retrieve the records for the control.

Run-Time Properties (PHP)

Property Description
ComponentType Specifies type of an object, such as "TextBox", "Record", etc.
Parent Specifies parent container of an object, for example a record form for a textbox that is included within that form.
DataSource A Data Source object created for the purpose of retrieving and holding the IDs and values to be displayed in the control.
Errors An object that contains the error messages generated during script execution when submitted data fails verification or any other user defined condition is not fulfilled.
Visible This property controls the visibility of the control. If the property is set to false, the control will not be displayed.

Data Source properties

Property Description
DataSource->SQL  This property contains the main portion of the SQL query used to retrieve the records displayed within the control . In terms of SQL, this property defines the SELECT and FROM clauses of the SQL query.
DataSource->Where  This property contains the WHERE clause portion of the SQL query used to retrieve records for the control. The WHERE clause provides the criteria which filters the records retrieved. The value of this property is appended to the value of the DataSource->SQL property to create the final SQL query which is executed against the datasource to retrieve the records for the control.

Methods (PHP)

Method Description
GetValue Retrieves the value of the CheckBox List control. Only the first element of the array of values is retrieved.
SetValue Sets the value of the CheckBox List control.

Run-Time Properties (.NET)

Interface System.Web.UI.WebControls.CheckBoxList class is used.

Property Description
Items Gets the collection of items in the list control. See the .NET Framework SDK reference.
SelectedIndex Gets or sets the lowest ordinal index of the selected items in the list. See the .NET Framework SDK reference.
SelectedItem Gets the selected item with the lowest index in the list control. See the .NET Framework SDK reference.
Visible This property controls the visibility of the control. If the property is set to false, the control will not be displayed.

Model Layer

Property Description
<control name> Contains the current value of the control.
<control name>Items This is a Collection of the control items.

Run-Time Variables (CF,CFT)

Variable Description
arr_<owner name><control name> This variable contains the array of items in the control.
fld<control name> Holds the value of the control. This variable can contain a semicolon separated list of values
hide<control name> This variable controls the visibility of the control. If the variable is set to true, the control will not be displayed.
strOrder<control name>  This property contains the ORDER BY clause portion of the SQL query used to retrieve records for the control. The ORDER BY clause determines the order of appearance of the retrieved records. The value of this property is appended to the value of the strSQL<control name> property to create the final SQL query which is executed against the datasource to retrieve the records for the control.
strSQL<control name>  This property contains the main portion of the SQL query used to retrieve the records displayed within the control. In terms of SQL, this property defines the SELECT and FROM clauses of the SQL query.
strWhere<control name>  This property contains the WHERE clause portion of the SQL query used to retrieve records for the control. The WHERE clause provides the criteria which filters the records retrieved. The value of this property is appended to the value of the strSQL<control name> property to create the final SQL query which is executed against the datasource to retrieve the records for the control.
query<control name>  This variable contains the query object associated with the control. 

Methods (Servlets & JSP)

MethodDescription
addValue In the case where the CheckBox List allows for the selection of multiple values, this function is used to add a value to the list of selected values.
setValues Set the list of selected values from an enumeration of Strings.
setListOfValues Set the list of values to choose from. Used to populate list values from a String.
getOptions Get the options list in the form of an enumeration of Strings.
setOptions Set the list of values to choose from. Used to populate list values from a String.
getFormattedOptions Prepare list collection for output. This method marks those list values that were selected by request.
getPage Get the page that contains this control.
getFormattedValue Get the value formatted according to the control format.
setFormattedValue Use a String to set the control value. The value is taken as is i.e. formatting will not be applied to this value.
hasErrors Indicates whether the control has (validation) errors.
addError Add an error description to the errors collection.
getErrorsAsString Return a single String with all the error messages separated by &lt;br&gt; tags.
isVisible Returns a value indicating whether this control should be displayed or not.
setVisible Specify whether this control should be shown.
getParent Get the parent component that contains this control.

See also

Checkbox List Overview


On-line, printable versions and updates