Chapter 8. Building forms with Tag Helpers

 

This chapter covers

  • Building forms easily with Tag Helpers
  • Generating URLs with the Anchor Tag Helper
  • Using Tag Helpers to add functionality to Razor

In chapter 7, you learned about Razor templates and how to use them to generate the views for your MVC application. By mixing HTML and C#, you can create dynamic applications that can display different data based on the request, the logged-in user, or any other data you can access.

Displaying dynamic data is an important aspect of many web applications, but it’s typically only one half of the story. As well as displaying data to the user, you often need the user to be able to submit data back to your application. You can use data to customize the view, or to update the application model by saving it to a database, for example. For traditional web applications, this data is usually submitted using an HTML form.

In chapter 6, you learned about model binding, which is how you accept the data sent by a user in a request and convert it into a C# object that you can use in your action methods. You also learned about validation, and how important it is to validate the data sent in a request. You used DataAnnotations to define the rules associated with your models, as well as other associated metadata like the display name for a property.

8.1. Catering to editors with Tag Helpers

8.2. Creating forms using Tag Helpers

8.3. Generating links with the Anchor Tag Helper

8.4. Cache-busting with the Append Version Tag Helper

8.5. Using conditional markup with the Environment Tag Helper

Summary

sitemap