Server-side processing is at the heart of ASP.NET, but as AJAX controls prove, the judicious addition of script to be run on the browser can be a distinct advantage. It can speed up a page’s execution by controlling how it communicates with the server and it can provide a much-improved user experience as well.
There are exceptions to the rule, of course: some ASP.NET server controls use client-side scripting to provide responses to user actions without posting back to the server. For example, validation controls typically download a script to the browser so that invalid data is caught and flagged to the user without requiring a round trip to the server. In these cases, this client-side script is provided by ASP.NET and you, the developer, do not have to write or manage that script.
As you will see, you can call client-side code from any ASP.NET server control. In addition, the ASP.NET
Button server control has a property,
OnClientClick, which lets you specify client-side script to execute when the button is clicked.