6 Working with forms: Tag helpers

This chapter covers

  • Building forms with tag helpers
  • Controlling input types with data annotations
  • Populating select lists with server-side code
  • Working with check boxes and radio buttons in forms
  • Uploading files to the server

The last chapter covered how model binding takes form input and binds it to handler parameters and public properties in Razor Pages. You learned that the key to ensuring successful binding is ensuring that the name of the binding source matches that of the binding target. Up to now, you have generated the name of your form controls manually. This potentially error-prone approach doesn’t move you much beyond fishing around in the Request.Form collection for your posted values.

In Razor ...

Get ASP.NET Core Razor Pages in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.