This documentation is archived and is not being maintained.

What's New in Code-Behind Support in Visual Web Developer

Visual Studio 2005

This topic describes changes in how single-file and code-behind Web pages are supported in Visual Web Developer, which is the Web site development tool (Web page designer) that is included with Visual Studio 2005.

In Visual Studio .NET version 2003, the default for writing code was the code-behind model. When you created a new Web Forms page, Visual Studio created an .aspx page with the markup and a separate .vb or .cs file (the code-behind file) for the page's code. The code-behind file defined a complete class derived from the Page class.

The Visual Studio Web page designer kept the .aspx page and the code-behind page in synch. For example, if you added a Web server control to the .aspx page, the designer created a corresponding instance variable in the code-behind page for that control.

In Visual Studio .NET 2003, the Web page designer offered only limited support for single-file pages. You could edit pages in the designer, but the full array of designer features was not available unless you were working with code-behind pages.

Changes in Support for Code

In Visual Studio 2005, support for creating the code for your page has been improved. The following table summarizes the improvements and provides links to more information about each feature.

Feature Description

Improved code-behind model.

The code-behind model now uses a partial class that provides a cleaner, more robust way to integrate code with the page. For details, see ASP.NET Web Page Code Model.

Support for single-file pages.

The designer provides equal support for code-behind and single-file pages, including IntelliSense. For information about choosing a model, see ASP.NET Web Page Code Model.

Dynamic compilation on server.

The designer no longer compiles all of the page code into a single assembly on your computer. Instead, by default, the pages are compiled dynamically into multiple assemblies on the server when requested. You still have the option to precompile your Web site into a layout on your computer and then deploy it to a production server.

For details, see Deploying ASP.NET Web Sites (Visual Studio).

NoteNote

You can compile a Web site into a set of assemblies that can be deployed without source code or in a format that allows limited changes. For more information, see What's New in Publishing Web Sites in Visual Studio.

No designer-only features.

The new model eliminates the need for the designer to include markup and code that exists only to support the designer. For example, the designer no longer requires the reserved InitializeComponent() method to remember control state across form loads at design time and to initialize controls for run-time execution. For more information, see Visual Studio Extensibility Center.

Expanded IntelliSense support.

IntelliSense is now supported throughout the designer, including code (both code-behind and single-file pages), markup, directives, and more. For more information, see Using IntelliSense and How to: Select Validation Schemas for HTML Editing in Visual Web Developer.

See Also

Show: