Custom label to Model property in ASP.NET MVC

How to apply a custom label to a model property in ASP.NET MVC?

To apply a custom label to the model field, Display attribute can be applied. 
[Display(Name = "Is Active?")] 
 public bool Active { get; set; }

Here the default label of the Active field appears as “Active” however if we want to change the label in the View, we can change it with the help of Display attribute as above.
[Display (Name = "the label value")] 

No comments:

Post a Comment

How to register multiple implementations of the same interface in Asp.Net Core?

 Problem: I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { ...