CheckBox V1.0 F1.7

File Name: Server_CheckBox.asp
Class Name: ServerCheckBox
Sample: CheckBox.asp

Overview
This control is used to implement a single <input type="CheckBox" control in a web form.



Public Constructors
New_ServerCheckBox(name) This constructor is used to create an instance of the control while at the same time assiging it a name and id.
ServerCheckBox() This is the default constructor and it will create an instance of the control without a name. Controls instanciated this way must assign the name of the control manually by doing this: <controlVariable>.Control.Name = "<ControlName>"

Public Properties
Caption String Sets/Gets the CheckBox caption
ReadOnly Boolean Sets/Gets the control editable flag (True/False)
Checked Boolean Sets/Gets the control value (True/False)
AutoPostBack Boolean Sets/Gets a control flag indicating if the page should be automaticaly posted back if the control change status.
OnClick String Sets/Gets Overrides the default event handler name (<ControlName>_Click)
Control WebControl Inherits attributes from the WebControl class. For more information go to the WebControl help.
RaiseOnChanged Boolean Gets/Sets a value to indicate wether or not the developerwants to be notified if the contents of the control changed during a postback. The event to be raised is ControlName_OnChanged(Control,Params)

Public Methods
(default) Render Renders the control to the page.
SetValueFromDataSource This method is used by the Page object when binding the whole page to a DataSource. In order for this to work, you need to se the DataTextField of the Control property. i.e. chkYesNo.Control.DataTextField = "SelectYN"

Public Events
Click This events is triggered only if AutoPostBack is set to true. The event name by default can be trapped by creating a function with the control name and the event name such as Public Function chkYesNo_Click(). The name of the event can be overrided by changing the OnClick property.
OnChanged (Control,Params) This event is triggered if the status of the CheckBox changed. Control is the CheckBox and Params is not used.

Protected Properties
mbolWasRendered Boolean True if the control was already rendered, otherwise false. This is needed by the ProcessPostBack when restoring from the viewstate as this type of input only post data in the form if checked. This makes difficult to determine if the value was not posted because the control was not rendered (visible=false, or other conditon in the page) or it was not checked. This value is stored in the viewstate of the control to support this determination.
mPropBag PropertyBag Holds temporarily a reference the control viewstate (property bag) so it can later store if the control was or not rendered. (see above)

Protected Methods
WriteProperties(bag) Invoked by the CLASP Framework to allow the control to restore its state after a postback. Bag is of type PropertyBag and can be used to read (or write) to the control viewstate.
ReadPropertied(bag) Invoked by the CLASP Framework to allow the control to persist its state before the page is destroyed. Bag is of type PropertyBag and can be used to read (or write) to the control viewstate.

Protected Events
HandleClientEvent Invoked by the CLASP Framework to allow the control to handle the postback event. From here the control can determine what is the course of action. In this case, if OnClick <> "" then it will invoke the function specified in the property, else it will invoke the default handler, if any.