The Html.LabelFor helper method can be used to display label in the ASP.NET MVC View . The LabelFor takes the parameter of the property defined in the model to display the text .
Specifying Text for Html.LabelFor in ASP.NET MVC Application
The developers can use the DisplayAttribute for the property which is used in the System.ComponentModel.DataAnnotations namespace .
For example , is the property name in the model is FirstName , we can use the DisplayAttribute like the way shown below.
[Display(Name = "First Name")] public string FirstName { get; set; }
Leave a Reply