Ch09.HighlightedHyperlink", this.ClientID);
descriptor.AddProperty("highlightCssClass", this.HighlightCssClass);
descriptor.AddProperty("nohighlightCssClass", this.NoHighlightCssClass);
return new ScriptDescriptor[] { descriptor };
}
The preceding code creates a client-side component called ControlsBook2Lib.Ch09.
HighlightedHyperlink in the constructor for the ScriptBehaviorDescriptor object. The
constructor also provides the client-side name of the server control that the client-side component
interacts with via the this.ClientID property. Since AJAX extender server controls apply behaviors
via client-side components to other ASP.NET server controls, this.ClientID would not be
used. Instead, for an extender control, the value passed in would be targetControl.ClientID.
After the new ScriptBehaviorDescriptor object is created, methods are called to set properties
(via AddProperty), event handler names (via AddEvent), and so forth on the client-side
component created in the constructor.
Implementing an ASP.NET AJAX custom server control requires a bit more work, which we
describe later in this chapter. First, we dive in with example code that leverages the ASP.NET
AJAX client library functionality in the next section.
Pages:
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545