SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 126 | Next

Robin Pars, Laurence Moroney, and John Grieb

"Foundations of ASP.NET AJAX"

This is definitely a lot shorter than having to write document.getElementById(??¦) as
commonly done in raw JavaScript. After the X and Y coordinates are parsed out of the text
boxes using the parseInvariant static method of the Number object, they are passed onto
the setLocation method of the Sys.UI.DomElement for the panel to be moved to the new
coordinates. setLocation takes in three parameters: the control name, the new X coordinate,
and the new Y coordinate. After the relocation, the getLocation method is used to
fetch the new coordinates from the panel object itself (as represented by the MovePanel
tag). Lastly, the format method of the String extension is used to display the new
coordinates to the user as shown in Figure 4-8.
Figure 4-8. The panel is relocated to the new coordinates with a message box showing the
new positional values.
Nothing is done here that could not be done by raw JavaScript alone. But using the
ASP.NET AJAX Client Library is not only a lot cleaner with much less code, but it also
provides a level of abstraction that guarantees expected behavior in all of the popular
browsers (IE, Firefox, Opera, Safari).


Pages:
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138