Using Atlas Controls
There are two concepts the Atlas framework uses with the controls in Sys.UI. Some of these controls provide JavaScript access to standard JavaScript methods. The others provide JavaScript access to HTML elements on the current page. Both ways are demonstrated in this section.
Accessing JavaScript Methods
One example of the first method is implemented by Sys.UI.Window. This implements a client-side message box.
The JavaScript language supports three types of modal message boxes:
-
window.alert() Message box with an OK button
-
window.confirm() Message box with OK/Cancel or Yes/No buttons
-
window.prompt() Message box with an input field and an OK button
Inside the Atlas Sys.UI.Window class, the functionality for calling window.alert() or window.confirm() is encapsulated in the messageBox() method. The default behavior is to present a window.alert() box. This corresponds to the message box style Sys.UI.MessageBoxStyle.OK. The alternative is to use the Sys.UI.MessageBoxStyle.OKCancel style, which uses window.confirm() under the covers.
But what about the window.prompt() window? For consistency with Visual Basic, this is implemented via the inputBox() method instead of the messageBox() method.
The following example implements all three variants of client modal window. Three client-side buttons are in place for calling the Atlas functionality:
<input type="button" value="MessageBoxOK" onclick="MessageBoxOKClick();" /> <input type="button" value="MessageBoxOKCancel" ...