Last post Jan 09, 2018 12:01 PM by PatriceSc
Jan 09, 2018 11:27 AM|tridip1974|LINK
please tell me the difference between LabelFor and DisplayFor
@Html.LabelFor(m => m.StudentName) and @Html.DisplayFor(m => m.StudentName)
when to use DisplayFor and when LabelFor ?
DisplayFor can show the html without explicitly decode?
what html tag DisplayFor generate
Jan 09, 2018 12:01 PM|PatriceSc|LINK
LabelFor is to show the name of a property (and clicking the name should set focus to the corresponding field).
DisplayFor is to show the value of a property
EditorFor is to show the value of a property using an input field
Just try to see which markup is rendered. The point is that you can customize which template is used. See for example :