ASP.NET MVC > Models

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")] 

 Views: 18128 | Post Order: 38

Write for us

Hosting Recommendations