c# - set property as ShowForEdit -


i've found following code creates custom object template

@foreach (var prop in viewdata.modelmetadata.properties .where(pm => pm.showforedit && !viewdata.templateinfo.visited(pm))) {     <div class="editor-field-container">     @if (!string.isnullorempty(        html.label(prop.propertyname).tohtmlstring())) {            <div class="editor-label">               @html.label(prop.propertyname):             </div>      }      <div class="editor-field">         @html.editor(prop.propertyname)         @html.validationmessage(prop.propertyname, "*")      </div> <div class="cleaner"></div> </div> }  

since example loops through modelmetadata.propertiesthat should shown editing , have not been shown before, displaying label, editor template, , validation message each property in set of divtags.

my question is: how can set showforedit attribute. tried attribute inside viewmodel

using system.componentmodel.dataannotations  [showforedit] public string name {get; set;} 

but [showforedit] not set, i'm missing major here. can explain me how set property shownforedit inside viewmodel?

update: , custom object template should saved (inside mvc4 app).


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -