Main Page

  Previous Section Next Section

Chapter 3. Web Forms

Web Forms are an ASP.NET technology used to create programmable web pages. They are the primary building block of ASP.NET Web Applications. The main goal of Web Forms is to bring the same productivity to web applications that Visual Basic brought to Windows applications. Web Forms consist of the user interface (UI) and the UI logic written on the server side. The UI and UI logic can reside either in the same file or in separate files.

Web Forms in ASP.NET offer a number of advantages over ASP and other technologies for generating web applications. ASP.NET Web Forms:

  • Provide support for any HTML 3.2-compliant browser. Even ASP.NET Server Controls that provide advanced client-side functionality will gracefully degrade for browsers that do not support DHTML or script. These controls will, however, take advantage of such support in browsers such as Internet Explorer 5.0 or later.

  • Are built on the Common Language Runtime and provide all the benefits of the runtime, such as managed execution, type safety, and inheritance.

  • Can be built with any Common Language Runtime language, including C#, Visual Basic .NET, and JScript .NET.

  • Can be created using rapid application development tools such as Visual Studio .NET. You can build a Web Forms page simply by dragging and dropping controls from the VS.NET toolbox onto the page.

  • Provide a rich set of server controls that provide almost all the functionality required for a web application. ASP.NET ships with a broad array of built-in server controls.

  • Offer a flexible programming model, in which code may be included in the same file as the Web Form, as in the classic ASP model or in separate module files, referred to as code-behind files. Code-behind promotes the separation of code and content, which can improve your code's readability, maintainability, and reusability.

  • Preserve the state of the page and its controls between requests with the inclusion of state management features. This facility is explained in detail in Section 3.3 later in this chapter.

  • Provide an extensible model that allows you to develop your own controls or purchase third-party controls to add functionality to your application.

      Previous Section Next Section