What's New in Web Forms in ASP.NET 4.5

Version: 1.2.0


ASP.NET Web Forms 4.5 introduces a number of improvements focused on improving the experience when working with data. These include strongly-typed data controls, model binding capabilities, new request validation features and asynchronous page processing enhancements. In this lab, you will get a chance to try out these new features and learn how they work.


The upcoming version of ASP.NET Web Forms introduces a number of improvements focused on improving user experience when working with data.

In previous versions of Web Forms, when using data-binding to emit the value of an object member, you used the data-binding expressions Bind() or Eval(). In the new version of ASP.NET, you are able to declare what type of data a control is going to be bound to by using a new ItemType property. Setting this property will enable you to use a strongly-typed variable to receive the full benefits of the Visual Studio development experience, such as IntelliSense, member navigation, and compile-time checking.

With the data-bound controls, you can now also specify your own custom methods for selecting, updating, deleting and inserting data, simplifying the interaction between the page controls and your application logic. Additionally, model binding capabilities have been added to ASP.NET, which means you can map data from the page directly into method type parameters.

Validating user input should also be easier with the latest version of Web Forms. You can now annotate your model classes with validation attributes from the System.ComponentModel.DataAnnotations namespace and request that all your site controls validate user input using that information. Client-side validation in Web Forms is now integrated with jQuery, providing cleaner client-side code and unobtrusive JavaScript features.

Lastly, in the request validation area, improvements have been made to make it easier to selectively turn off request validation for specific parts of your applications or read invalidated request data.


In this hands-on lab, you will learn how to:

  • Use strongly-typed data-binding expressions
  • Use new model binding features in Web Forms
  • Use value providers for mapping page data to code-behind methods
  • Use Data Annotations for user input validation
  • Take advange of unobstrusive client-side validation with jQuery in Web Forms
  • Implement granular request validation
  • Implement asyncrhornous page processing in Web Forms



Throughout the lab document, you will be instructed to insert code blocks. For your convenience, most of that code is provided as Visual Studio Code Snippets, which you can use from within Visual Studio to avoid having to add it manually.

To install the code snippets:

  1. Open a Windows Explorer window and browse to the lab’s Source\Setup folder.
  2. Double-click the Setup.cmd file in this folder to install the Visual Studio code snippets.

If you are not familiar with the Visual Studio Code Snippets, and want to learn how to use them, you can refer to the appendix from this document ‘Appendix: Using Code Snippets’.


This hands-on lab includes the following exercises:

  1. Exercise 1: Model Binding in ASP.NET Web Forms
  2. Exercise 2: Data Validation
  3. Exercise 3: Asynchronous Page Processing in ASP.NET Web Forms
Each exercise is accompanied by a starting solution—located in the Begin folder of the exercise—that allows you to follow each exercise independently of the others. Please be aware that the code snippets that are added during an exercise are missing from these starting solutions and that they will not necessarily work until you complete the exercise.

Inside the source code for an exercise, you will also find an End folder containing a Visual Studio solution with the code that results from completing the steps in the corresponding exercise. You can use these solutions as guidance if you need additional help as you work throughout this hands-on lab.