Lesson 4: Adding the ErrorMessage Property to the [Required] Attribute

Опубликовано: 08 Апрель 2026
на канале: Paul D. Sheriff
249
9

Lesson 4: Adding the ErrorMessage Property to the [Required] Attribute

In this lesson you override the ErrorMessage property on the [Required] attribute. You also learn how to use placeholders within the ErrorMessage.

Content
Lesson Objectives 00:00
DEMO: Add ErrorMessage Property to the [Required] Attribute 00:14
DEMO: Use Placeholders in the ErrorMessage Property 01:10
DEMO: Add the ErrorMessage Property to all [Required] Attributes 02:05
DEMO: Allow Empty Strings 02:42
Lesson Summary 03:32

Useful Links
Samples and hands-on labs for this course: https://www.pdsa.com/YouTube
The ValidationAttribute class: https://learn.microsoft.com/en-us/dot...
The [Required] Attribute: https://learn.microsoft.com/en-us/dot...
The ErrorMessage Property: https://learn.microsoft.com/en-us/dot...

#dataannotation #validation #csharp #development #programming #dotnet #dotnetcore #dotnet6 #dotnet #dotnet8 #pauldsheriff #pluralsight #youtube

Paul.About()
Hello, my name is Paul D. Sheriff and I have a passion for teaching. I have been training developers for over 35 years through books, videos, article, blog posts, and international conferences and user groups.

Paul.Contact()
Website: https://www.pdsa.com
Email: [email protected]
LinkedIn:   / paulsheriff  
Blog: https://blogs.pdsa.com/
Pluralsight: https://app.pluralsight.com/profile/a...
YouTube Channel: @pauldsheriff