Thursday, April 26, 2007
The AJAX Conspiracy
I’m a reasonably proficient person. So I must be misreading the situation. .NET 2.0 provides the mechanism for the asynchronous handling of events without postback. For a page to take advantage of this mechanism, the page class in the code-behind file must implement the ICallbackHandler interface with the functions RaisePostbackEvent which takes in a string argument that is passed in by the client script and ReturnPostbackEvent? Which returns the string result after any manipulation. In order to write the script that performs the asynchronous call in the first place, in the load event of the page a ClientScriptManager object is gotten from the Request object and a call to GetCallbackReference with the relevant parameters provides the actual javascript call itself (web_doCallback(…)). The ClientScript object writes a clientside javascript function that calls the callback reference. To initiate the callback, a command object like a button only needs to have an OnClientClick event=”SoandSoFunction()”. SoandSoFunction() calls web_doCallback with the right parameters. A “fake” page is loaded into memory and initialized partially? Then the interface methods are called in order to process the input and return output. The returned output comes asynchronously and is handled by a client side javascript function registered in the earliest processes. This function has handles to all controls on the page and can update them at will. This is Asynchronous Javascript. What I don’t understand is…. AJAX. Why do people need a “.dll” for AJAX when the .NET framework provides all you need for complete asynchronous domination? Or am I misreading things? What’s this about an ajax wrapper? What is so hard about async? If I’m correct, to make an ajax enabled control, first assume that in your page_load you have access to client side scripting. If this is so, then you write the script for initiating the callback, you get the reference callback (web_doPostback with the right parameters), register the client side callback handler, write the javascript for the client side callback handler, implement ICallbackHandler interface, then render the control so that it’s command has a client-side handler component. Isn’t this Ajax?????????
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment