Applying a custom label to the model field ?

Sunny.Sagar
Posted by Sunny.Sagar under ASP.NET MVC category on | Points: 40 | Views : 1847
To apply a custom label to the model field, Display attribute can be applied.
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
Simple code :

[Display(Name = "Is Active?")]
public bool Active { get; set; }

Comments or Responses

Login to post response