I have a painfully simple view model
public class TellAFriendViewModel { public string Email1 { get; set; } public string Email2 { get; set; } pu
You should access
ViewData.ModelMetadata.Properties. No reason to double the reflection effort, plus it figures out DataAttributes metadata for you.
ViewData.ModelMetadata.Properties
@foreach(var property in ViewData.ModelMetadata.Properties) { @(property.DisplayName??property.PropertyName) @Html.Editor(property.PropertyName) }