ServerButton V1.0 F1.7

File Name: Server_Button.asp
Class Name: ServerButton.asp
Overview
The ServerButton class handles Push Buttons, LinkButtons and ImageButtons. They all behave the same way and trigger the same events in the server side. The type of button is controlled by the Mode property. Each mode can have extra properties used to render the control.  



Public Constructors
New_ServerButton This constructor is used to create an instance of the control while at the same time assiging it a name and id. It uses the default Mode (1).
New_ServerLinkButton This constructor is used to create an instance of the control while at the same time assiging it a name and id. It uses the Mode = 2 to create a link button.
New_ServerImageButton This constructor is used to create an instance of the control while at the same time assiging it a name and id. It uses the Mode = 3 to create a Image Button
New_ServerAdvanceButton This constructor is used to create an instance of the the control, assing the name and use mode = 4 (use the Button tag)
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 the WebControl class. For more information go to the WebControl help.
CommandSource String Any string that you want to pass to the OnClick event during a postback.
OnClick String If set, it will override the default event handler for the button (which is the ControlName followed by "_OnClick()". This can be useful to have different buttons use the same handler.
Text String Applies to PushButtons and LinkButtons and is used to Get/Set the text to be displayed.
Mode Int 1 = PushButton, 2 = LinkButton, 3 = ImageButton, 4 = Advance Button
Image String Used by LinkButtons and ImageButtons and is used to Get/Set the image/appereance of the button.
RollOverImage String Used by the ImageButton and is used to Get/Set the image url for when the mouse hovers over the button.
Target String Used to set the Target Frame for ImageButtons and LinkButtons.
CausesValidation Boolean

Used to determine if this button will trigger a form validation event (default true). This is used in conjunction with the Server Validation controls. At this point it only supports CLIENT SIDE vaidation. We are working on a summary validation and on the ability to test on the server.

ValidationGroup String CLASP supports validations by group. This allows you to specify which validation group the control belongs to and will fail only if controls within that group fail validation.

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
-- --

Protected Properties
-- -- --

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.
RenderButton Renders the control as a PushButton
RenderLinkButton Renders the control as a LinkButton
RenderImageButton Renders the control as a ImageButton
RenderAdvanceButton Renders the control using the Button tag.

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.