METHOD

EditContext.GetValidationMessages

Enumerates current validation messages for a field across stores, without triggering validation. Materialize the enumeration when an independent snapshot is needed. Requires the ASP.NET Core shared framework or matching reference assemblies.

Formal Syntax & Structure

csharp syntaxcsharp
context.GetValidationMessages(field)

Working Example

Example Snippetcsharp
using System;using System.Linq;using System.Threading;using Microsoft.AspNetCore.Components;using Microsoft.AspNetCore.Components.Forms;using Microsoft.AspNetCore.SignalR;var context=new EditContext(new object()); var store=new ValidationMessageStore(context); var field=context.Field("Title"); store.Add(field,"Required"); Console.WriteLine(context.GetValidationMessages(field).Single()); // Required
C# & .NET Reference