5 Working with forms - model binding
This chapter covers
- Model binding in Razor Pages
- Binding complex objects easily
- Protecting your application by validating user input
- Leveraging data annotation attributes to manage validation
Right at the beginning of this book, I congratulated you for choosing ASP.NET Core Razor Pages In Action if you wanted to learn how to build “page-focused interactive web applications”. I didn’t really expand on the meaning of “interactive” at the time. Essentially, an interactive web application is one where users can provide input and affect the behavior of the application. In the last chapter, you saw how a user can alter a URL to interact with the application, causing the City page to display different content based on the value of a route parameter. In this chapter, you get to understand and begin to work with the primary interaction mechanism in a web application - the form.