Hello @Kuler Master ,
Thanks for reaching out.
Blazor does not include built-in support for ValidationGroups like ASP.NET Web Forms. This is a deliberate design choice, reflecting Blazor’s modern, component-based architecture and its reliance on EditForm and data annotations for validation.
That said, you can achieve similar behavior using a few alternative strategies:
- Separate EditForms: Divide your form into multiple EditForm components, each with its own model and validation context. This effectively isolates validation logic per section.
- Custom Validation Logic: Use Blazor’s EditContext and ValidationMessageStore to manually control which fields are validated and when. This gives you fine-grained control over validation behavior.
- Conditional Validation Attributes: Implement custom validation attributes that activate based on a group identifier or context. This allows selective validation depending on the current form state or user action.
These approaches align with Blazor’s philosophy of clean separation of concerns and reusable components. While they may require more setup than Web Forms, they often result in more maintainable and scalable applications.
Hope this helps.