UpdatePanel Data Transfer and the beginRequest and endRequest client side page life cycle events - More Wally - Wallace B. McClure
in

MoreWally.com

Giving people what they want, More Wally. This is the technical and personal blog site of
Wallace B. (Wally) McClure.

This Blog

Syndication

Technical Sites

Archives

More Wally - Wallace B. McClure

This blog will have all kinds of posts about Wally McClure. In it, there will be tons of .NET and computer programming posts as well as Wally's views on life in general. As you might guess, this site and blog help you get More Wally in your life. What more could anyone want? iPhone, Android, Xamarin.iOS, Xamarin.Android, Mobile, HTML5, .NET, ADO.NET, ASP.NET, AJAX, jQuery, jQuery Mobile, ASP.NET AJAX, and Windows Azure............follow me on twitter at Wally

UpdatePanel Data Transfer and the beginRequest and endRequest client side page life cycle events

Is AJAX really AJAX?  The answer, like many other things, is “It Depends.”  The AJAX acronym states that the X is for XML.  I can’t speak for all frameworks, but some frameworks use JSON (JavaScript Object Notation) for some amount of their data transfer. 

The UpdatePanel is a little bit different.  It doesn’t always use JSON.  It uses a custom textual format.  On the arguments of the EndRequest  handler that I created, the Args.get_response().getResponseData() method returns the content that is sent from the server to the web browser when the updatepanel sends data down to the client.  The format of the data seems to be: Size|ControlType|ControlName|ControlData.  In this case, the size is 2775 bytes(I assume), the updatePanel is being acted on, the control that is acted upon is uplSearch, and then the data that is sent.

 

I hope that this is an interesting fact that has brightened your day.  Note that this also shows how to use the beginRequest and endRequest client side page life cycle events.

 

Code I used:

        <script language="javascript" type="text/javascript">

        <!--

        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandle);

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandle);

        function beginRequestHandle(sender, Args)

        {

            alert("Begin Request Handle called.");

        }

        function endRequestHandle(sender, Args)

        {

            for(m in Args.get_response())

            {

                if((m.indexOf("get_") == 0)&&(m!="get_object"))

                {

                    alert(m + ": " + eval("Args.get_response()." + m + "()"));

                }

            }

            alert("End Request Handle called.");

        }

        -->

        </script>

 

Data that was sent back:

Comments

 

Wallace B. McClure said:

November 1, 2006 9:06 PM
 

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com
November 3, 2006 7:00 AM
2006 - Wallace B. McClure
Powered by Community Server (Non-Commercial Edition), by Telligent Systems