Prev | Current Page 551 | Next

Rob Cameron and Dale Michalk

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


Since HighlightedHyperLink is just a customization of the ASP.NET HyperLink control, it
inherits from HyperLink but implements IScriptControl to bring in the ASP.NET AJAX functionality.
The associated client-side component HighlightedHyperLink is contained in an embedded
resource ControlsBook2Lib.Ch09.HighlightedHyperLink.js file. As before, the script is marked
as embedded, and an Assembly:WebResource attribute is used to make it available via the
GetScriptReferences method.
To ensure proper behavior in HighlightedHyperlink, since it implements the IScriptControl
interface directly, the OnPreRender method is overridden to check for the presence of a
ScriptManager control. In addition, even though this control inherits from an existing ASP.NET
CHAPTER 9 ?–  A SP.NET A JAX C ONTROLS AND EXTENDERS 433
control (HyperLink), it overrides the Render method to make the required call to ScriptManager.
RegisterScriptDescriptors to wire up the client-script with the ASP.NET client-script engine.
The HighlightedHyperLink ASP.NET AJAX server control has to properties to configure
the client-side component behavior called HighlightCssClass and NoHighlightCssClass.
These properties backed by ViewState are configured on the client-side component via the
GetScriptDescriptors method.


Pages:
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563