Developer dashboard is convenient tool for troubleshooting in Sharepoint. It allows you to see how many time each function is executed during request lifetime (by default it shows some standard functions. If you want to see your own custom functions you have to enclose their body within SPMonitoredScope). There is a lot of resources available in internet which show in details how to configure and us it. I won’t repeat it here. Instead I will show how to use Developer dashboard in ajax-enabled web applications, where most of communications with user occur inside UpdatePanel.
The common usage of Developer dashboard in this scenario is the following: on the masterpage there is DeveloperDashboard and DeveloperDashboardLauncher controls. Main content placeholder is located within UpdatePanel. Also it is possible that UpdatePanel is added on particular page or web part. And there is one problem with such configuration: Developer dashboard will show you information only about 1st http get request, while other asynchronous http post requests occurred from inside UpdatePanel won’t be traced.
Solution of this problem is quite simple: add DeveloperDashboard control into own separate UpdatePanel. The key element of understanding how it works is UpdatePanel.UpdateMode property. It may have 2 possible values:
- Always (default)
- Conditional
As documentation says when you use Always update mode which is default:
The content of the UpdatePanel control is updated for all postbacks that originate from the page. This includes asynchronous postbacks.
I.e. UpdatePanel with DeveloperDashboard will be updated even if requests will come from another UpdatePanels. If in your application you use Conditional mode, you have to explicitly call Update() method on the UpdatePanel with DeveloperDashboard when request came from other “basic” UpdatePanel. After that you will be able to trace all request, not only 1st http get request for the page. Hope this technique will help you.
No comments:
Post a Comment