Tracing Asp.net Ajax Client Side Request
When you add script manager control on the page, it not only goes though page life cycle on the server but the request goes through series of events on the client side. There are two client side objects available in asp.net Ajax; Sys.Application and Sys.WebForms.PageRequestManager object. Sys.Application events are raised because of scriptmanager and PageRequestManager events gets raised only when there are updatePanels present on the page. In order to illustrate all these events I will use tracing feature available in asp.net Ajax. By using Sys.Debug.trace, I will write trace messages to a textarea with id equal to TraceConsole. If you have Firebug extension installed on firebox, the traces get automatically written to the trace console of Firebug. Here is how my markup looks like.
In the above code, I am making use of application page load event which gets automatically called by asp.net Ajax framework if you name it exactly as pageLoad. In the application pageLoad event I am register most of the events that gets raised by PageRequest Manager. Probably in future blog postings I will cover in details about what these events do and how you can leverage them in the client side framework. I also have a text area which is where all the traces gets written to. It is essential that you use id of TraceConsole for the output of Debug trace to get written to the textarea. When the page gets posted by the button inside of UpdatePanel, I am writing out the event name that gets raised in the trace console. Here is an example of the output that gets written.
Here is the resulting output being written to the firebug trace console when viewing the page in FireFox.