String Validation using Property name when showing error

I have this property in Model class

    [Required]
    [StringLength(15)]
    [DisplayName("Name")]
    public string NameProp { get; set; }

When I edit the value of the NameProp cell and try to finish editing with empty value, it shows error " The NameProp field is required", which is expected and correct but I do not want it to show Property name but the name provided in DisplayName's Value.


Is there any way to do that ?


Edit : Got it

Using

[Display(Name = "Name")]



1 Reply

RM Rabina Murugan Syncfusion Team May 6, 2025 07:41 AM UTC

Hi John,    
            
We glad that the query was addressed from your side.
 
we would like to clarify that currently  SfDataGrid does not support the [DisplayName] attribute for setting column headers. Instead, we follow the Microsoft standard practice by providing support for the [Display(Name = Name")] attribute, which is commonly used for data annotation in UI display scenarios.
 
Please get back to us if you need any further assistance.
 
Regards,
Rabina

Loader.
Up arrow icon