UpdatePanel Data Transfer and the beginRequest and endRequest client side page life cycle events - Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions
Cross posted from: http://morewally.com/cs/blogs/wallym/archive/2006/11/01/470.aspx
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: