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
Post a Comment