Web
ASP.NET AJAX
In the past developers used <body onload="..."> to execute some script as soon as the page is loaded. Nowadays this is rather old-fashioned, no matter how you look at it. What's more, it doesn't work as expected in ASP.NET AJAX websites. Consider the following example: <body onload="MyFunction()"> <script type="text/javascript"> function MyFunction() { var myAjaxControl = $find("myAjaxControlClientID"); myAjaxControl.doSomething(); } </script> </body> The client-side page load event is fired by the browser as soon as all HTML and scripts have been loaded. However, this happens before the controls' client-side instances have been created. As a result, myAjaxControl will be null and the doSomething() method will trigger a Javascript error. So, a lot better approach...