ServerDropDown V1.0 F1.7

File Name: Server_DropDown.asp
Class Name: ServerDropDown.asp

Overview

Renders a single-selection (dropdown) or multiple- selection list (list view) that can be dynamically created by binding the control to a data source or by adding the items manually.

Public Constructors
New_ServerDropDown(name) This constructor is used to create an instance of the control while at the same time assiging it a name and id.
New 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
Control WebControl Inherits attributes from WebControl.
DataTextField String Gets/sets the field of the data source that provides the text content of the list items.
DataValueField String Gets/sets the field of the data source that provides the value of each list item.
ReadOnly Boolean Set/Sets a value to indicate wether or not the user can change the selection. (it will be rendered as a label if not).
Items ListItemsCollection List items are stored here.
AutoPostBack Boolean Gets/Sets a value indicating whether a postback to the server automatically occurs when the user changes the list selection.
Multiple Boolean

Gets/Sets a value to indicate wether or not the lsit supports sinle or multiple selections. Is is just a Wrapper for Items.Mode

Rows Int Gets/Sets a value that indicates the number of rows of the list.
CaptionCssClass String Gets/Sets the class of the caption
CaptionStyle String Gets/Sets the style of the caption
Caption String Gets/Sets the caption of the dropdown.
Value Variant Sets/Gets the selected value of the list. It is a wrapper for Items.SetSelectedByValue
Text Variant Sets/Gets the selected text of the radio button list. It is a wrapper for Items.SetSelectedByText
RaiseOnChanged Boolean

Gets/Sets a value to indicate wether or not the develper wants to be notified if the dropdown value changed during a postback. The event to be raised is ControlName_OnChanged(Control,Params)

(Implemented obnly for dropdowns/ not for list boxes)


Public Methods
(default) Render Renders the control to the page.
SetFromCache(XMLCache) Used to set a cached XML representation of the ListItemsCollection.
SetValueFromDataSource(value) 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. cboCity.Control.DataTextField = "CityID"
DataBind() Binds the Contents of the DataSource and adds items to the ListItemsCollection. You must specify a DataSource and the DataTextField. You can provide the DataValueField which will be used to set the value of each checkbox, if not supplied then the Ordinal position will be used instead.

Public Events
<Control_Name>_OnChange(ClientEvent) This event is triggered if the AutoPostBack property is set to true. This is different from the OnChanged, which does not require the AutoPostBack to be true.
OnChanged (Me,oldValue) event is triggered if the value of the dropdown was changed.

Protected Properties
mbolWasRendered Boolean True if the control was already rendered, otherwise false. This is needed by the ProcessPostBack event and is used to  determine if the value was not posted because the control was not rendered (visible= false, or other conditon in the page).
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.
RenderDropDown() Renders the the dropdown.

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.