Prev | Current Page 539 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

The HoverButton Web Form Code-Behind Class File
using System;
namespace ControlsBook2Web.Ch09
{
public partial class HoverButton : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
We now dive into the contents of HoverButton.js, which contains the HoverButton client
control. The ASP.NET AJAX client script library provides support for namespaces via the Type.
registerNamespace call, which helps to keep things organized.
CHAPTER 9 ?–  A SP.NET A JAX C ONTROLS AND EXTENDERS 423
Writing object-oriented-like JavaScript using the ASP.NET AJAX library is fairly straightforward
but requires a deeper level understanding of the JavaScript language. An excellent MSDN
article that provides great background can be found here:
http://msdn.microsoft.com/msdnmag/issues/07/05/JavaScript/default.aspx
In HoverButton.js, you find a HoverButton constructor function, a HoverButton prototype,
and a call that registers the HoverButton class into the client-side framework. The constructor
does what you would expect; that is, it initializes the class through a call to initializeBase and
then sets the event handlers to null. Through the client-side framework, when the developer
user creates a HoverButton client control as in HoverButton.


Pages:
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551