ModelMetadata for complex type in editortemplate in asp.net mvc -


I have a view-model that includes complex assets of the testting type that has been declared as:

  public class test {{display (name = "string 3", prompt = "string 4")] public string test 1 {get; Set; } [Display (name = "string5", prompts = "string 6")] public string test 2 {received; Set; }}   

I have an editor template like this in which I want to be able to access meta data for each child's assets. If the template was for a string, for example, I can use the prompt text using @ ViewData.ModelMetadata.Watermark , but because it's a complex type, I use this method can not do.

Is there any alternative?

You can get metadata for each property:

  @ {Var Metadata = Modelmatetada .FromLambdaExpression & lt; Testing, String & gt; (X => x.Test2, ViewData); Var watermak = Metadata. Watermark; }    

Comments