In-Depth

VSLive! 2007: ASP.NET AJAX Under the Hood

Scott Cate illustrates how to implement key features of ASP.NET AJAX to a packed crowd at VSLive! San Francisco 2007.

AJAX to a packed crowd at VSLive! San Francisco 2007.
by Peter Varhol

Watch the video of the session! (Running time: 1 hour 2 minutes)

Scott Cate
President
myKB.com, Inc.

The VSLive! San Francisco 2007 session by Scott Cate on Microsoft's ASP.NET AJAX would have been standing-room only, except there wasn't room available to stand. Over 200 attendees were crammed into the conference room, making it one of the most popular breakout sessions at the event. Cate didn't disappoint the crowd, using only three content-free PowerPoint slides and five minutes before he drove directly into the code.

The key to ASP.NET AJAX on the client, according to Cate, is the use of the UpdatePanel control. By wrapping any control with the UpdatePanel, you make its data available to asynchronous updates. If the UpdateMode property of the UpdatePanel control is set to Always, then the UpdatePanel control's content is updated on every postback that originates from the page. This includes asynchronous postbacks from controls that are inside other UpdatePanel controls and postbacks from controls that are not inside UpdatePanel controls.

Cate illustrated this principle using a DataGrid control in an application. He wrapped a DataGrid control with an UpdatePanel in an ASP.NET 2.0 application and demonstrated that any updates to the grid did not require a refresh of the entire page. Rather, the update was processed asynchronously back to the server and the value alone was refreshed on the page.

You can use multiple UpdatePanel controls to update different page regions independently. When the page that contains one or more UpdatePanel controls is first rendered, all the content in the UpdatePanel controls is also rendered and sent to the browser. On subsequent asynchronous postbacks, the content of each UpdatePanel control might not be updated depending on the panel settings and on client or server logic for individual panels.

You can illustrate this principle in an example ASP.NET 2.0 page, by taking two identical controls and wrapping one of them in an UpdatePanel. Making the same change to both controls shows that the control using the UpdatePanel updates more quickly and seamlessly, without a page update. The other control requires a full page refresh, no matter how trivial the change.

The popularity of Cate's session says a lot about the growing popularity of AJAX among developers in general, and Visual Studio developers in particular. AJAX, which allows asynchronous updates through the use of scripting, is rapidly becoming a standard for usability in Web applications. Microsoft's ASP.NET AJAX framework provides you with an easier way of achieving this standard in Visual Studio—forget about manually writing scripts.

About the Author

Peter Varhol is the executive editor, reviews of Redmond magazine and has more than 20 years of experience as a software developer, software product manager and technology writer. He has graduate degrees in computer science and mathematics, and has taught both subjects at the university level.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube