Prev | Current Page 456 | Next

Rob Cameron and Dale Michalk

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

NET via the
ClientScriptManager class that is attached to the Page class as a static ClientScript property
for emitting JavaScript into the HTML output in a modular manner. This capability includes a
registration system that ensures only a single instance of a block of script code is emitted in the
final HTML output, despite the presence of multiple instances of a server control that need it
on a web form. The ClientScriptManager replaces the now-obsolete methods that hang off the
Page class directly as static methods and consolidates client interaction in one class. Table 8-1
summarizes the script-related feature set of ClientScriptManager.
Table 8-1. ASP.NET ClientScriptManager Class Script Registration Methods
Method Description
RegisterClientScriptBlock Emits the specified JavaScript code at the top of the HTML
form to allow all of the controls on the page rendered after it
to reference it.
IsClientScriptBlockRegistered Checks to see if a previous control has registered a
JavaScript block at the top of the HTML form.
RegisterStartupScript Emits the specified JavaScript code at the bottom of the
HTML form to be able to access any of the controls on the
web form from the script block.
IsStartupScriptRegistered Checks to see if a previous control has registered a start-up
JavaScript block at the bottom of the HTML form.


Pages:
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468