ASP.NET AJAX UpdatePanel Messages

Microsoft made some fairly significant changes to the way ASP.NET AJAX UpdatePanel control messages are sent to and from the server in the latest beta release.  In earlier versions XML was used.  For example, a portion of a response message is shown below that contains a <delta> tag and others to track changes to the control (I removed quite a bit of the actual response message to keep it short and to the point):

<delta>
      <rendering>
          ….Head information
          <panelContent id="updPanel">
             <div>
                <table cellspacing="0" border="0" id="gvCustomers">
                   <tr align="left">
                       <td>SIMOB</td><td>Jytte Petersen</td>
                       <td>Simons bistro</td><td>Denmark</td>
                  </tr>
               </table>
             </div>
          </panelContent>
      </rendering>
      <hiddenField id="__VIEWSTATE" value="/wEPDwU…" />
      <deltaPanels>updPanel</deltaPanels>
      <pageRequestManager asyncPostbackControlIDs=''  
         updatePanelIDs='updPanel' />
</delta>

The UpdatePanel in the new control keeps the message sizes down because it uses a pipe-delimited approach to the response message rather than XML tags.  Here's an example that contains most of the data sent back for an UpdatePanel request using the latest ASP.NET AJAX beta.  I stripped out a lot of the ViewState to keep it concise.

 605|updatePanel|udPanel|
  <div>
 <table cellspacing="0" border="0" id="gvCustomers">
   <tr align="left">
        <td>SIMOB</td><td>Jytte Petersen</td>
         <td>Simons bistro</td><td>Denmark</td>
   </tr>
 </table>
 </div>
<input type="hidden" name="hidField" id="hidField" value="Denmark" />
            |468|hiddenField|__VIEWSTATE|/wEPDwULL...=|80|hiddenField|__EVENTVALIDATION|/wEWB..|
20|asyncPostBackControlIDs||btnSubmit,btnSubmit2|0|postBackControlIDs|||
8|updatePanelIDs||tudPanel|0|childUpdatePanelIDs|||7|panelsToRefreshIDs||udPanel|
2|asyncPostBackTimeout||90|35|formAction||CustomersViewerWithUpdatePanel.aspx|
32|pageTitle||Customer Viewer with UpdatePanel| 

You can see that the message contains the length of each item (thanks to Ryan Trudelle-Schwarz for pointing out that the first number was length....I thought it was an ID of some type at first glance), the type, name and value.  I think this is a good move since it should keep overall message sizes down compared to using a lot of different XML tags.

If you're interested in seeing what type of data is sent behind the scenes using XmlHttp with ASP.NET AJAX controls check out the excellent Fiddler tool located at http://www.fiddlertool.com.

I'll be talking about different ways XML and Web Services can be used with ASP.NET AJAX server-side and client-side controls at the DevConnections conference this week.  If you'll be at the conference come on by my AJAX session.  If you can't make it you can find the presentation and code here.

comments powered by Disqus

3 Comments

Comments have been disabled for this content.