A few weeks ago, Microsoft announced a new version of ASP.NET and revealed some of its hottest features. ASP.NET 2.0 is part of the new version of the .NET Frameworkcodenamed Whidbeyand will be 100 percent compatible with previous versions, both 1.0 and 1.1. First and foremost, ASP.NET 2.0 introduces no breaking changes and provides side-by-side compatibility with existing versions. At this time, the platform is available in alpha version (shipped at PDC) and will enter a public beta testing phase in a few months.
The first thing to note is that ASP.NET 2.0 continues on the way already plotted by its predecessorreducing the lines of code needed to set up an application. Several operations in ASP.NET 1.x required considerable programming efforts, most of which were not to implement complex functions but just boilerplate code. ASP.NET 2.0 significantly reduces the quantity of code to write and buries much of the needed code in a new bunch of classes. This is particularly true for data binding where the new data source model works in conjunction with new data-bound controls and provides codeless data binding. In addition to increased productivity, ASP.NET 2.0 aims at simplification of the web administration and targets lots of mobile devices with a common object model.
ASP.NET 2.0 comes with a long list of features although the overall architecture is roughly the same. It provides new user interface features such as Web Parts, master pages, and themes; a new family of controls for security (login, password recovery); personalization and membership; and a new and improved model of data binding. Lets take a closer look at two of themmaster pages and the data source object model.
A large number of web sites these days contain similar-looking pages that share the same header, footer, and perhaps some navigational menus or search forms. If you wrap these user interface elements in user controls and reference them in each page, you have a model that works but it soon becomes unmanageable as the number of pages grows. On purpose, ASP.NET 2.0 introduces master pages. A master page is a distinct file referenced at the application, as well as the page, level that contains the static layout of the page. A master page contains regions that each derived page can customize. A derived page is the collection of blocks that the runtime will use to fill the holes in the master. Master pages promotes page reusability but is not based, nor does it exploit, class inheritance. Finally, the binding between master and content pages is defined statically and cannot be changed or set programmatically.
ASP.NET 2.0 simplifies the data binding mechanism introducing a new family of data componentsthe data source componentsthat in turn support a declarative model of binding. The data source control represents a source of data that returns and accepts data over a well-known streamsuch as SQL, XML, DataSet, and custom formats such as the Microsoft Exchange Inbox or Microsoft Excel worksheets. At least for relatively common fetch-display-edit scenarios, data source objects offer a very approachable schema for any web developer and a time-saving resource for more seasoned programmers. All existing data-bound controls support the new data source model. Likewise do new data-bound controls such as the GridView and the DetailsView. The key advantage of data source objects is that they provide data management capabilities to user interface controls so that these controls can connect to back-end data sources. The interconnection takes place quite magically as the user interface controls and the data provider are unaware of each other.
Dino Esposito is Wintellect's ADO.NET and XML expert, and a trainer and consultant
based in Rome, Italy. Dino is a contributing editor to Windows Developer
Network and MSDN Magazine, and the author of several books for Microsoft
Press including Building Web Solutions with ASP.NET and ADO.NET
and Applied XML Programming for .NET. Contact Dino at [email protected].