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

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube