Welcome to my another Blazor series short topic, Validating Complex Type in a quick way in Blazor or if you having a problem in validating a reference field in your model. The problem with the current Blazor’s DataAnnotationValidator doesn’t include validation for complex type fields which I’ve scoured the internet for solution and here we go.

Quick validation of complex types in Blazor

Saturday, 16 July 2022
By TonyTony  


Quick validation of complex types in Blazor

Welcome to my another Blazor series short topic, Validating Complex Type in a quick way in Blazor or if you having a problem in validating a reference field in your model. The problem with the current Blazor’s DataAnnotationValidator doesn’t include validation for complex type fields which I’ve scoured the internet for solution and here we go.


Blazor Quick validation of reference field or complex types

Blazor Quick validation of reference field or complex types


First, we’re going to add DataAnnotation.Validation nuget package in both your UI and Model projects. As you can see, this package is currently experimental and its currently on release candidate.

First, we’re going to add DataAnnotation.Validation nuget package in both your UI and Model projects. As you can see, this package is currently experimental and its currently on release candidate.


 Decorate your model with [ValidateComplexType] to mark the field as a complex type.

Decorate your model with [ValidateComplexType] to mark the field as a complex type.


 In your EditForm, replace the DataAnnotationsValidator tag with ObjectGraphAnnotationsValidator.

In your EditForm, replace the DataAnnotationsValidator tag with ObjectGraphAnnotationsValidator.


 And, that’s it, the following fields from the Address object is now being validated here.

And, that’s it, the following fields from the Address object is now being validated here.



Container not found? solve this issue with this simple solution.
Unexpectedly, this laptop can handle content creation load, high graphics gaming and development.
Selenium ChromeDriver cannot assign requested address fix on Docker
Are you expecting to see a validation message for you complex type fields? here's the solution.
Finally fixed my Civilization 6 game by following this simple fix.
The details is so captivating that I've purchase it without second thinking.
I've found the laptop I've been looking for. The laptop has pros and cons, but weighing the advantages I've immediately purchased this beast. So far, I'm not regretting it.
This time, I've tried to assemble from the 00 series, P-Bandai Gundam Exia Repair 3 RG model kit.
Finally, got my highway RFIDs !
Unboxing of SIC Kamen Rider W - Luna Trigger and Heat Metal by Bandai
Unboxing and assembly of Haro Mechanical Mascot by Billion Spark Craftsmanship
Unboxing of Shotriser and progrise key holder
Panda Express Pricelist and Food Guide - Updated December 2021
Unboxing and comparison of Figure rise standard
Gundam RG difference with old HG.
Heroes Headquarters Ph playground and non-gun laser tag arena are now open at Shangri-la plaza.
Unboxing and Assembly of Petit'GGuy Divers Blue
Sailormoon Power bank with mirror
Get amazed and entertained with your kids on this outdoor activities you can do in Clark, Pampanga.
It's time to reward someone you love, order now for customized cakes, cakepops, cupcakes, and other pastry products.
Unleashed the adrenaline inside you as Aeonz Everything goes to Bounce Trampoline theme park, which located at SM SouthMall, Las Piñas City.
Silang, Cavite | VANS, Onitsuka Tiger, ASICS, Rayban Outlet Stores
The country's first digital park with 14 interactive attractions to explore.
Up to 70% discount of different participating brands Robinsons Appliances, Robinsons department store, South Star drug store, Daiso, Toy R Us, True Value, Handyman, Top shop, Dorothy Perkins and many more.
Arabica coffee shop (Arabica ph) from Kyoto Japan is now in the Philippines located at W City Center BGC Taguig. Menu List
PacSafe 20th year anniversary event @ SM Megamall GL SM Mega Fashion Hall September 6 to 9 2018 Up to 70% off plus extra 20% off on all items
Hawker Chan Pricelist and Food Guide
Leave a reply

I hope this information helps, if you have any further questions please don't hesitate to contact us.

Your e-mail address will not be published.

arrow_upward