In my Model I have a propety decorated with the AdditionalMetadata attribute to pass through help text that I want to render:
[AdditionalMetadata("HelpText", "help text goes here")]
In my EditorTemplate (/views/shared/editorTemplates/Object.ascx) I then check to see if this value is set:
<% if (ViewData.ModelMetadata.AdditionalValues.ContainsKey("HelpText"))
{ %>
<span class='editor-help'>
<%= ViewData.ModelMetadata.AdditionalValues["HelpText"].ToString()%>
</span>
<% } %>
However, when I put a breakpoint on ViewData.ModelMetadata.AdditionalValues, its always empty, even though I'm breaking on the correct field and the attribute is definitely set. I'm using MVC4 in case the behaviour has changed since MVC3?
Is there any other step I have to do to pass a custom vale through from the model to the view?
Thanks