Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 72 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
72
Dung lượng
752,51 KB
Nội dung
ASP.NET AJAX Client-Side PageRequestManager The last chapter followed the Page object through its life cycle phases to process the first request to a Web page enabled for partial page rendering. As you saw, the server response to this request contains a script block generated by the current server-side PageRequestManager instance. Recall that this script block takes the following two important actions: ❑ Calls the _initialize static method on the client-side PageRequestManager class to instantiate and initialize the current client-side PageRequestManager instance ❑ Calls the _updateControls instance method on the current client-side PageRequestManager instance, passing in four parameters: ❑ The first parameter is an array containing one string for each UpdatePanel server control on the current page. This string consists of two substrings. The first substring contains the letter t if the ChildrenAsTriggers property of the associated UpdatePanel server control has been set to true and the letter f otherwise. The second substring contains the value of the Unique ID property of the associated UpdatePanel server control. ❑ The second parameter is an array that contains the Unique ID property values of all server controls on the current page that cause synchronous page postbacks. ❑ The third parameter is an array that contains the Unique ID property values of all server controls on the current page that cause asynchronous page postbacks. ❑ The fourth parameter is a string that contains the asynchronous postback request timeout. Listing 22-1 presents an example of the script block rendered by the current server-side PageRequestManager instance. c22.indd 1033c22.indd 1033 8/20/07 8:38:07 PM8/20/07 8:38:07 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1034 Listing 22-1: The Sample Script Block that Arrives on the Client Side as Part of the Server Response <script type=”text/javascript”> //<![CDATA[ Sys.WebForms.PageRequestManager._initialize(‘ScriptManager1’, document.getElementById(‘Form1’)); Sys.WebForms.PageRequestManager.getInstance()._updateControls( [‘tUpdatePanel1’, ‘fUpdatePanel2’, ‘tUpdatePanel3’], [‘SyncButton1’, ‘SyncButton2’], [‘AsyncButton1’, ‘AsyncButton2’], ‘90’); //]] </script> In this chapter we’ll move on to the client side, where the server response — including this script block — arrives. As you can see, this script block automatically invokes the _intialize and _updateControls methods of the client-side PageRequestManager . Figure 22-1 depicts the instantiation and initialization of the current PageRequestManager instance. As you can see, this figure diplays the two method calls I’ve discussed. Note that this figure contains two dashed lines. The top one represents the method calls triggered by the call into the _initialize method of the PageRequestManager . The bottom one repre- sents the method calls triggered by the call into the _updateControls method. I’ll discuss these two sets of triggered method calls in the following sections, and update this figure with new method calls as we move through the chapter. PageRequestManager Instantiation/Initialization PageRequestManager _initialize(scriptManagerUniqueID, formElement) _updateControls([…], […], […], asyncPostBackTimeout) Figure 22-1 Instantiating and Initializing the Client-Side PageRequestManager Listing 22-2 presents the internal implementation of the _initialize static method of the client-side PageRequestManager . c22.indd 1034c22.indd 1034 8/20/07 8:38:08 PM8/20/07 8:38:08 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1035 Listing 22-2: The _ initialize Static Method of the PageRequestManager Client Class Sys.WebForms.PageRequestManager._initialize = function Sys$WebForms$PageRequestManager$_initialize(scriptManagerID, formElement) { Sys.WebForms.PageRequestManager._ensureSinglePageRequestManagerInstance(); Sys.WebForms.PageRequestManager._createPageRequestManagerInstance(); Sys.WebForms.PageRequestManager._initializePageRequestManagerInstance( scriptManagerID, formElement); } Note that this method takes two parameters. The first is a string that contains the value of the Unique ID property of the current ScriptManager instance; the second references the form HTML element that contains the current ScriptManager instance. This method first calls the _ensureSinglePageRequestManagerInstance static method on the PageRequestManager to ensure that the current page contains a single PageRequestManager instance. As the following code listing shows, _ensureSinglePageRequestManagerInstance calls the getInstance static method on the client-side PageRequestManager to check whether the current page already contains an instance of the client-side PageRequestManager class. If so, it raises an exception, because every page can contain only one instance of this class: Sys.WebForms.PageRequestManager._ensureSinglePageRequestManagerInstance = function Sys$WebForms$PageRequestManager$_ ensureSinglePageRequestManagerInstance() { if (Sys.WebForms.PageRequestManager.getInstance()) throw Error.invalidOperation(Sys.WebForms.Res.PRM_CannotRegisterTwice); } Next, _initialize calls the _createPageRequestManagerInstance static method on the PageRequestManager to create a new instance of the PageRequestManager . As the following code listing shows, this method instantiates an instance of the client-side PageRequestManager class and assigns it to the _instance static field of this class: Sys.WebForms.PageRequestManager._createPageRequestManagerInstance = function Sys$WebForms$PageRequestManager$_createPageRequestManagerInstance() { Sys.WebForms.PageRequestManager._instance = new Sys.WebForms.PageRequestManager(); } Finally, the _initialize method calls the _initializePageRequestManagerInstance static method to initialize the newly created PageRequestManager instance. As the following code listing shows, this method calls the _initializeInternal private instance method on the newly instantiated client-side PageRequestManager , passing in the value of the Unique ID property of the ScriptManager server control and the reference to the form HTML element of the current page: c22.indd 1035c22.indd 1035 8/20/07 8:38:08 PM8/20/07 8:38:08 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1036 Sys.WebForms.PageRequestManager._initializePageRequestManagerInstance = function Sys$WebForms$PageRequestManager$_createPageRequestManagerInstance( scriptManagerID, formElement) { Sys.WebForms.PageRequestManager.getInstance()._initializeInternal( scriptManagerID, formElement); } Figure 22-2 updates Figure 22-1 to add the method calls triggered by the _initialize static method of the PageRequestManager . The get Instance Method of the Client-Side PageRequestManager Listing 22-3 presents the internal implementation of the getInstance static method of the client-side PageRequestManager class. As you can see, this method returns the value of the _instance static field of the PageRequestManager client class. If you need to access this instance from your client-side code, call the getInstance static method on the client-side PageRequestManager class to return a reference to the current client-side PageRequestManager instance. Figure 22-2 PageRequestManager Instantiation/Initialization PageRequestManager _ensureSinglePageRequestManagerInstance ( ) getInstance ( ) _createPageRequestManagerInstance ( ) _initializePageRequestManagerInstance (scriptManagerUniqueID, formElement) _initializeInternal (scriptManagerUniqueID, formElement) _initialize(scriptManagerUniqueID, formElement) _updateControls([…], […], […], asyncPostBackTimeout) c22.indd 1036c22.indd 1036 8/20/07 8:38:08 PM8/20/07 8:38:08 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1037 Listing 22-3: The get Instance Static Method of the PageRequestManager Client Class Sys.WebForms.PageRequestManager.getInstance = function Sys$WebForms$PageRequestManager$getInstance() { /// <returns type=”Sys.WebForms.PageRequestManager”></returns> return Sys.WebForms.PageRequestManager._instance || null; } The Constructor of the Client-Side PageRequestManager Class Listing 22-4 presents the implementation of the constructor of the client-side PageRequestManager class. As this code listing shows, this class contains the following private fields: ❑ _form : This field references the form DOM element associated with the HtmlForm server control. Keep in mind that an ASP.NET page may have more than one instance of the <form> HTML element. However, only one of these <form> HTML elements can have the runat=”server” attribute. The ASP.NET framework represents this <form> HTML element with an instance of the HtmlForm server control. The _form field of the client-side PageRequestManager references the <form> HTML element that contains the runat=”server” attribute. ❑ _updatePanelIDs : This field is an array that contains the values of the Unique ID properties of all UpdatePanel server controls on the current page after update. ❑ _updatePanelClientIDs : This field is an array that contains the values of the ClientID properties of all UpdatePanel server controls on the current page after update. ❑ _oldUpdatePanelIDs : This field is an array that contains the values of the Unique ID properties of all UpdatePanel server controls on the current page before update. ❑ _childUpdatePanelIDs : This field is an array that contains the values of the Unique ID properties of all child UpdatePanel server controls after update. ❑ _panelsToRefreshIDs : This field is an array that contains the values of the Unique ID properties of all parent UpdatePanel server controls that need refreshing. ❑ _updatePanelHasChildrenAsTriggers : This field is an array that contains the values of the Unique ID properties of all UpdatePanel server controls on the current page whose ChildrenAsTriggers Boolean property have been set to true . ❑ _asyncPostBackControlIDs : This field is an array that contains the values of the Unique ID properties of all server controls on the current page that cause asynchronous page postbacks. ❑ _asyncPostBackControlClientIDs : This field is an array that contains the values of the ClientID properties of all server controls on the current page that cause asynchronous page postbacks. ❑ _postBackControlIDs : This field is an array that contains the values of the Unique ID properties of all server controls on the current page that cause synchronous page postbacks. ❑ _postBackControlClientIDs : This field is an array that contains the values of the ClientID properties of all server controls on the current page that cause synchronous page postbacks. c22.indd 1037c22.indd 1037 8/20/07 8:38:08 PM8/20/07 8:38:08 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1038 ❑ _scriptManagerID : This field contains the value of the Unique ID property of the current ScriptManager server control. ❑ _pageLoadedHandler : This field references the delegate registered as an event handler for the load event of the window object. ❑ _additionalInput : This field contains additional optional information. ❑ _onsubmit : This field references the original onsubmit method of the form DOM element that the _form field references. As you’ll see later, the client-side PageRequestManager instance replaces this method with another method when it needs to make an asynchronous page post- back to the server. Before replacing this method, the current client-side PageRequestMananger instance stores the function in the _onsubmit field so it can be used later when the page needs to make a synchronous page postback. ❑ _onSubmitStatements : This field is an array that contains dynamically added form submit statements. ❑ * _originalDoPostBack : This field references the _doPostBack JavaScript function that per- forms a regular synchronous page postback to the server. As you’ll see later, the client-side PageRequestManager instance replaces this JavaScript function with the one that performs an asynchronous page postback to the server when PageRequestManager needs to make an asyn- chronous postback request. Before replacing the _doPostBack JavaScript function, the current client-side PageRequestManager instance stores the function in the _originalDoPostBack field so it can be used later when the page needs to make a synchronous page postback. ❑ _postBackSettings : This field references an object literal with three name/value pairs that describe the postback settings for the postback request that the current client-side PageRequestManager instance is about to make to the server. The name part of the first name/ value pair is the keyword async , and the value part is a Boolean value that specifies whether the current postback request is asynchronous. The name part of the second name/value pair is the keyword panel ID , and the value part is a string that contains the value of the Unique ID property of the UpdatePanel server control whose trigger triggered the current asynchronous page postback. The name part of the third name/value pair is the keyword sourceElement , and the value part references the DOM element that triggered the asynchronous page postback. ❑ _request : This field references the WebRequest object that represents the current asynchronous page postback request. ❑ _onFormSubmitHandler : This field references the delegate that represents the _onFormSubmit method of the current PageRequestManager instance. As you’ll see later, this instance registers this delegate as an event handler for the submit event of the form DOM element referenced by the _form field. ❑ _onFormElementClickHandler : This field references the delegate that represents the _onFormElementClick method of the current PageRequestManager instance. As you’ll see later, this instance registers this delegate as an event handler for the click event of the form DOM element referenced by the _form field. ❑ _onWindowUnloadHandler : This field references the delegate that represents the _onWindowUnload method of the current PageRequestManager instance. As you’ll see later, this instance registers this delegate as an event handler for the unload event of the form DOM element referenced by the _form field. ❑ _asyncPostBackTimeout : This field is a string that contains the asynchronous page postback request timeout. c22.indd 1038c22.indd 1038 8/20/07 8:38:09 PM8/20/07 8:38:09 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1039 ❑ _controlIDToFocus : This field is a string that contains the value of the Unique ID property of the server control that has the mouse focus. ❑ _scrollPosition : This field references an object literal with two name/value pairs that describe the current position of the scroll. The name part of the first name/value pair is the keyword x , and the value part is an integer that specifies the x coordinate of the scroll bar. The name part of the second name/value pair is the keyword y , and the value part is an integer that specifies the y coordinate of the scroll bar. ❑ _dataItems : This field references a dictionary of data items. ❑ _response : This field references the WebRequestExecutor object responsible for executing the current asynchronous page postback request. ❑ _processingRequest : This field is a Boolean value that specifies whether the current PageRequestManager is processing the server response. ❑ _scriptDisposes : This field references a dictionary of script disposes. Listing 22-4: The Constructor of the PageRequestManager Client Class Sys.WebForms.PageRequestManager = function Sys$WebForms$PageRequestManager() { this._form = null; this._updatePanelIDs = null; this._updatePanelClientIDs = null; this._oldUpdatePanelIDs = null; this._childUpdatePanelIDs = null; this._panelsToRefreshIDs = null; this._updatePanelHasChildrenAsTriggers = null; this._asyncPostBackControlIDs = null; this._asyncPostBackControlClientIDs = null; this._postBackControlIDs = null; this._postBackControlClientIDs = null; this._scriptManagerID = null; this._pageLoadedHandler = null; this._additionalInput = null; this._onsubmit = null; this._onSubmitStatements = []; this._originalDoPostBack = null; this._postBackSettings = null; this._request = null; this._onFormSubmitHandler = null; this._onFormElementClickHandler = null; this._onWindowUnloadHandler = null; this._asyncPostBackTimeout = null; this._controlIDToFocus = null; this._scrollPosition = null; this._dataItems = null; this._response = null; this._processingRequest = false; this._scriptDisposes = {}; } Sys.WebForms.PageRequestManager.registerClass(‘Sys.WebForms.PageRequestManager’); c22.indd 1039c22.indd 1039 8/20/07 8:38:09 PM8/20/07 8:38:09 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1040 The _ initialize Internal Method of the Client-Side PageRequestManager Understanding the internal implementation of the _initializeInternal method of the current PageRequestManager instance requires a good understanding of the two common types of page postback. Therefore, before diving into the implementation of this method, we need to study these two different types. The first relies on the Submit button. As you know, when the user clicks the Submit button, the form DOM element raises the submit event and consequently invokes the onsubmit event handler. If the onsubmit event handler does not return false , the browser takes these steps: 1. Collects the names and values of the form elements. 2. Generates a list of items separated by the & character, where each item contains the name and value of a form element. Each item consists of two parts separated by the equals sign ( = ), the first containing the name of the form element and the second containing the value. 3. Creates an HTTP POST request. 4. Adds the list of items to the body of the request. 5. Sets the request headers, such as Content-Type, Content-Length, Host, etc. 6. Submits the request to the server synchronously. The onsubmit event handler normally validates the values of the form elements and returns false to cancel the form submission if the validation fails. The main problem with the first type of page postback is its strict reliance on the Submit button for form submission. There are times when the form must be submitted via DOM elements other than the Submit button. For example, you may want the form submission to occur when the user selects an item from a certain HTML element. This is where the second type of page postback comes into play. This type relies on the __doPostBack JavaScript function. The ASP.NET server controls, such as the DropDownList , register this JavaScript function as an event handler for one of their events. For example, the DropDownList server control registers the _doPostBack JavaScript function as event handler for the onchange event of the <select> HTML element associated with the server control if the AutoPostBack property of the server control is set to true . Listing 22-5 contains the definition of the _doPostBack JavaScript function. Since this JavaScript func- tion is a global one, it is automatically considered as a method on the window object. As you can see, _doPostBack takes two arguments. The first is the value of the Unique ID property of the server control that caused the postback. For example, in the case of the DropDownList server control, this will be the value of the Unique ID property of the DropDownList control itself. The second argument is optional. In the case of the DropDownList server control, this will be the value of the value property of the selected <option> element of the <select> element associated with the server control. As you can see from Listing 22-5 , the _doPostBack JavaScript function takes the following steps. First, it invokes the onsubmit event handler. Recall that this event handler normally validates the values of the form elements and returns false if the validation fails. As Listing 22-5 shows, if the onsubmit event handler does not return false , the _doPostBack JavaScript function assigns its first parameter to the value property of a hidden field named __EVENTTARGET and its second parameter to the value c22.indd 1040c22.indd 1040 8/20/07 8:38:10 PM8/20/07 8:38:10 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1041 property of a hidden field named __EVENTARGUMENT . For example, in the case of the DropDownList server control, the _doPostBack JavaScript function assigns the Unique ID property value of the server control to the value property of the __EVENTTARGET hidden field and the value of the value property of the selected option subelement of the select element associated with the server control to the value property of the __EVENTARGUMENT hidden field. theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; Finally, the _doPostBack JavaScript function invokes the submit method on the form DOM element to submit the values of the form elements to the server. When the submit method is invoked, under the hood, the browser takes these steps: 1. Collects the names and values of the form elements. 2. Generates a list of items separated by the & character, where each item contains the name and value of a form element. Each item consists of two parts separated by the equals sign ( = ), the first containing the name of the form element and the second containing the value. 3. Creates an HTTP POST request. 4. Adds to the body of the request the list of items shown in Step 2. 5. Sets the request headers, such as Content-Type, Content-Length, Host, etc. 6. Submits the request to the server synchronously. Note that the preceding six steps are the same ones the browser takes for the first type of page postback — that is, the page postback via the Submit button. In other words, both the page postback via the Submit button and the page postback via the _doPostBack JavaScript function rely on the browser to take these steps. Listing 22-5: The Standard __ do PostBack JavaScript Function <script type=’text/javascript’> <! var theForm = document.forms[‘Form1’]; if (!theForm) theForm = document.Form1; function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } // > </script> Both the page postback via the Submit button and page postback via the _doPostBack JavaScript func- tion suffer from the following fundamental shortcomings: c22.indd 1041c22.indd 1041 8/20/07 8:38:10 PM8/20/07 8:38:10 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1042 ❑ The browser submits the request to the server synchronously. A synchronous request is blocking , meaning that the end user cannot interact with the page until the server response arrives. This dramatically degrades the responsiveness, performance, and usability of a Web application that relies heavily on normal synchronous page postbacks. ❑ In both types of page postbacks, when the server response finally arrives, the entire page reloads even though only a small portion of the page requires refreshing. This also dramatically de- grades the responsiveness, performance, and usability of a graphic-heavy Web page, which takes a lot of time to re-render. As you’ll see in this chapter, the current PageRequestManager instance resolves both of these problems, as follows: ❑ Unlike page postback via the Submit button or the _doPostBack JavaScript function, it does not rely on the browser’s default synchronous form submission. Instead, the current PageRequestManager instance uses the ASP.NET AJAX client-server communication layer discussed in previous chapters to make asynchronous page postback requests to the server. ❑ Unlike page postback via the Submit button or the _doPostBack JavaScript function, it does not rely on the browser’s default rendering mechanism, which re-renders the entire page when the server response arrives. Instead, the current PageRequestManager instance uses the ASP.NET AJAX client-side framework to refresh only those parts of the page that need refreshing. Now that you have a good understanding of the two main types of page postbacks and their shortcom- ings, you’re ready to dive into the internal implementation of the _initializeInternal method of the PageRequestManager , as shown in Listing 22-6 . Listing 22-6: The _ initialize Internal Intance Method of the PageRequestManager Client Class function Sys$WebForms$PageRequestManager$_initializeInternal(scriptManagerID, formElement) { this._scriptManagerID = scriptManagerID; this._form = formElement; this._detachAndStoreOriginalFormOnSubmit(); this._registerHandlerForFormSubmitEvent (); this._detachAndStoreOriginalDoPostBack(); this._attachNewDoPostBack(); this._registerHandlerForWindowLoadEvent(); this._registerHandlerForFormClickEvent(); this._registerHandlerForWindowUnloadEvent(); this._storeOriginalFormAction(); } As you can see, this method takes two arguments. The first is a string that contains the value of the UniqueID property of the ScriptManager server control. The second references the form DOM element of the current page. The method assigns the following two parameters to the _scriptManagerID and _form private fields of the current PageRequestManager instance: this._scriptManagerID = scriptManagerID; this._form = formElement; c22.indd 1042c22.indd 1042 8/20/07 8:38:10 PM8/20/07 8:38:10 PM [...]... this._uniqueIDToClientID(postBackControlIDs[i])); As Listing 2 2-8 shows, the _uniqueIDToClientID method takes an UniqueID value as its argument and replaces all the dollar signs ($) with the underscore character (_) 1048 c22.indd 1048 8/20/07 8:38:12 PM Chapter 22: ASP.NET AJAX Client-Side PageRequestManager The UniqueID and ClientID property values of an ASP.NET server control are read-only, which means that only the ASP.NET can set their... right after the current client-side PageRequestManager instance is instantiated and initialized 1055 c22.indd 1055 8/20/07 8:38:14 PM Chapter 22: ASP.NET AJAX Client-Side PageRequestManager Listing 2 2-1 2: A Page that Uses the pageLoaded Event to Execute Application-Specific Logic ... ( ) Figure 2 2-4 1049 c22.indd 1049 8/20/07 8:38:13 PM Chapter 22: ASP.NET AJAX Client-Side PageRequestManager The _pageLoadedInitialLoad Method of the Client-Side PageRequestManager When the current page is finally loaded, the window object raises the load event and calls the _pageLoadedHandler delegate, which in turn calls the _pageLoadedInitialLoad instance method of the current client-side PageRequestManager... the ASP.NET AJAX client-server communication layer (discussed in previous chapters) to submit the form asynchronously If these methods determine that the page postback must be done synchronously, they simply get out of the way and let the browser’s default synchronous form submission take over and submit the form synchronously 1051 c22.indd 1051 8/20/07 8:38:13 PM Chapter 22: ASP.NET AJAX Client-Side... _registerHandlerForFormClickEvent ( ) _registerHandlerForWindowUnloadEvent ( ) _updateControls([…], […], […], asyncPostBackTimeout) _storeOrigianlFormAction ( ) Figure 2 2-3 1045 c22.indd 1045 8/20/07 8:38:11 PM Chapter 22: ASP.NET AJAX Client-Side PageRequestManager _updateControls Listing 2 2-7 presents the internal implementation of the _updateControls method of the PageRequestManager This method takes the following four parameters:... event handler for the pageLoaded event of the current client-side PageRequestManager instance Register the JavaScript function from Step 3 as an event handler for the load event of the window object Listing 2 2-1 2 contains a page that uses this recipe If you run this page, you should see the results shown in Figures 2 2-6 and 2 2-7 As Figure 2 2-6 shows, this page consists of a parent UpdatePanel server... Mover object, passing in the delegate Recall from Chapter 7 that the addContent method automatically invokes this delegate and consequently the addUpdatePanel method on the UpdataPanelProvider object updatePanelMover.addContent(addUpdatePanelDelegate); 1067 c22.indd 1067 8/20/07 8:38:18 PM Chapter 22: ASP.NET AJAX Client-Side PageRequestManager Listing 2 2-1 4 presents the content of the Delegates.js JavaScript... // Need to use “new Object()” instead of “{}”, since the latter breaks code // coverage this._dataItems = dataItems || new Object(); } (continued) 1053 c22.indd 1053 8/20/07 8:38:14 PM Chapter 22: ASP.NET AJAX Client-Side PageRequestManager Listing 2 2-1 1 (continued) function Sys$WebForms$PageLoadedEventArgs$get_dataItems() { /// return this._dataItems; } function Sys$WebForms$PageLoadedEventArgs$get_panelsCreated()... Now let’s revisit Listing 2 2-1 0, as shown again in the following code listing: function Sys$WebForms$PageRequestManager$_pageLoaded(initialLoad) { var handler = this._get_eventHandlerList().getHandler(“pageLoaded”); if (handler) { var args = this._getPageLoadedEventArgs(initialLoad)); handler(this, args); } 1054 c22.indd 1054 8/20/07 8:38:14 PM Chapter 22: ASP.NET AJAX Client-Side PageRequestManager... return a reference to the JavaScript function whose invocation automatically 1050 c22.indd 1050 8/20/07 8:38:13 PM Chapter 22: ASP.NET AJAX Client-Side PageRequestManager invokes all the event handlers registered for the pageLoaded event of the current client-side PageRequestManager instance I’ll discuss this event later in the chapter var handler = this._get_eventHandlerList().getHandler(“pageLoaded”); . asyncPostBackTimeout) Figure 2 2-3 c22.indd 1045c22.indd 1045 8/20/07 8:38:11 PM8/20/07 8:38:11 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1046 _ update Controls Listing 2 2-7 presents the. 8:38:12 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1049 The UniqueID and ClientID property values of an ASP. NET server control are read-only, which means that only the ASP. NET can. asyncPostBackTimeout) Figure 2 2-4 c22.indd 1049c22.indd 1049 8/20/07 8:38:13 PM8/20/07 8:38:13 PM Chapter 22: ASP .NET AJAX Client-Side PageRequestManager 1050 The _ page LoadedInitialLoad Method of the Client-Side