I have a view model with a property on it that looks like this:
[Display(Name = "Some Property", Description = "This is description", Prompt = "This is prompt")]
[Required(ErrorMessage = RequiredFieldMessage)]
public string SomeProperty { get; set; }
But this does not seem to render anything extra in the view. Do you need to do some additional work?
<div class="editor-label">
@Html.LabelFor(model => model.SomeProperty )
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.SomeProperty , 5, 80, null)
@Html.ValidationMessageFor(model => model.SomeProperty )
</div>
Not all of the built in EditorTemplates take advantage of all of the DataAnnotations, but they are there for when you write your own EditorTemplates you can leverage them.
Ordering doesn’t really apply unless you are doing
DisplayForModelorEditorForModelwhere its showing multiple editors for all the properties on the model, it can then order the Editor’s appropriately.If you wanted to take advantage of the
DescriptionandPromptmetadata you could write your ownStringEditorTemplate: