Specifying Text for Html.LabelFor in ASP.NET MVC Application


This content was proof-read by Grammarly. You can Try Grammary for FREE

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 .


Are you a .NET Developer planning to integrate GraphQL for .NET in your Application? Check out this book BUY & DOWNLOAD GRAPHQL.NET COOKBOOK

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; }

%d bloggers like this: