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. Data Annotations namespace and request that all your site controls validate user input using that information.
Client-side validation in Web Forms is now integrated with j Query, providing cleaner client-side code and unobtrusive Java Script features.
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 section, you will learn how to use data annotations for validating a new/edit customer form.
In previous version of Web Forms, handling database errors such as a too long string or a unique key violation could involve throwing exceptions in your repository code and then handling the exceptions on your code-behind to display an error.
In this exercise, you will learn about the new data validation features in ASP. You will check out the new unobtrusive validation features in Web Forms.
In this task, you will discover the new strongly-typed bindings available in ASP. One downside with the above approaches is that the calls to Eval() and Bind() are late-bound - meaning you pass strings to represent the property names.
This means you don't get Intellisense for the member names, support for code navigation (like Go To Definition), nor compile-time checking support.
Additionally, model binding capabilities have been added to ASP.
NET, which means you can map data from the page directly into method type parameters.
The ": " used in the expression will automatically HTML-encode the output to avoid security issues (for example, cross-site scripting attacks). NET 4 for response writing, but now is also available in data-binding expressions. NET Web Forms, when you wanted to perform two-way data-binding, both retrieving and updating data, you needed to use a Data Source object.