Delving Deeper into Atlas Client Controls - Buttons
(Page 3 of 4 )
HTML supports various kinds of buttons, e.g., <input type="submit"> to submit a form,<input type="reset">to clear a form (reset it to its original state), and<input type="button">and<button>for a button with no predefined behavior that can be enriched with JavaScript. Atlas implements buttons (<input type="button">or<button>, i.e., buttons that cannot serve any purpose without JavaScript) withSys.UI.Button. The following methods are supported:
get_argument()
Retrieves the argument sent along with the
command when the button is clicked
set_argument()
Sets the argument of the button
get_command()
Retrieves the command sent when the button is
clicked
set_command()
Sets the command of the button
Checkboxes
HTML uses <input type="checkbox"> for checkboxes. A checkbox has only two states: checked or not checked. These states can be set using JavaScript, so Atlas provides this functionality as well. The set_checked()method can change the state of a checkbox (by providing a Boolean value), andget_ checked()retrieves the current state. The associated class isSys.UI.CheckBox.
Example 4-5 uses HTML to create a checkbox, and Atlas/JavaScript to set its checked state to true.
Example 4-5. Using an Atlas CheckBox control
ControlCheckBox.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
<title>Atlas</title>
<script language="JavaScript" type="text/javascript">
function pageLoad() {
var checkbox = new Sys.UI.CheckBox($("CheckBox1"));
checkbox.set_checked(true);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager runat="server">
</atlas:ScriptManager>
<div>
<input type="checkbox" id="CheckBox1" />
<label for="CheckBox1">click me!</label>
</div>
</form>
</body>
</html>
Figure 4-5 shows the result displayed.
Next: Selection Lists >>
More ASP.NET Articles
More By O'Reilly Media
|
This article is excerpted from chapter four of the book Programming Atlas, written by Christian Wenz (O'Reilly, 2006; ISBN: 0596526725). Check it out today at your favorite bookstore. Buy this book now.
|
|