In addition to the Tag Helpers that ship with Core MVC, custom Tag Helpers can be added to support your development needs. In this video, I create a Tag Helper to properly format a mailto link, register the Tag Helper in _ViewImports.cshtml, and then update the Contact view to use the new Tag Helper.
- [Instructor] The final point of discussion…for views and tag helpers…is building a custom tag helper.…So let's add a new directory to our project,…and we'll call it appropriately, TagHelpers.…And then in here, we'll add a new C# class.…And we'll call this class EmailTagHelper.…
And we start every custom tag helper…by deriving from the tag helper class,…and we'll have to fix our usings.…We have some convenient properties we're going to add in,…and we're going to start off with a private constant string…and that's the RecipientAttributeName,…and we're going to call this mail-to.…
And then we're going to duplicate this line…and this will be the DomainAttributeName,…and email-domain.…So you notice that's it all kebab casing,…and that is, every word separated by a dash,…like it's on a shish kebab,…and this is technically lower kebab casing.…Now we're going to set up some properties…for our tag helper.…
These will be translated into attributes for us.…We're going to start with the HTML name attribute,…and this will be the recipient attribute name,…
Phil Japikse begins by showing how to install and update the .NET Core SDK. He reviews the functionality of the MVC 5 app, explains how to create necessary projects, and discusses migrating static content. Next, he demonstrates how to create a data access layer, complete the server-side migration, set up the HTTP pipeline, add custom items into the dependency injection container, leverage the new project configuration system, and migrate the controllers. Phil then introduces Tag Helpers—one the big new features in ASP.NET Core—and uses them to migrate and simplify the views. Phil also demonstrates how to create and use custom Tag Helpers. To wrap up, he covers working with view components, explaining what they are and why they're helpful. He walks through how to create the server-side view component code, and how to refactor your app and invoke the view component.
- Reviewing the MVC 5 application
- Creating the data access layer
- Adding and updating the models
- Updating the database
- Completing the server-side migration
- Configuring the HTTP pipeline
- Configuring and using dependency injection
- Migrating the views
- Creating view components
Skill Level Intermediate
Visual Studio Essential Training: 09 Unit Testswith Walt Ritscher2h 48m Intermediate
Deploying .NET Applications with Octopus Deploywith Floyd Hilton1h 27m Intermediate
1. Preparation and Initial Steps
2. Create the Data Access Layer
3. Complete the Server-Side Migration
4. Migrate the Controller
5. Migrate the Views
6. View Components
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.