私は以下のようなObject.cshtmlを使用してpublic int MyInt { get;set; }
いますが、必要な属性が欠落しているにもかかわらず、何らかの理由でこのような通常のintプロパティが必要です。どうしてですか?エディターテンプレートに何かが足りませんか?
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !ViewData.TemplateInfo.Visited(pm))) {
if (prop.HideSurroundingHtml) {
<text>@Html.Editor(prop.PropertyName)</text>
} else {
<div>
<div class="editor-label">
@if(prop.IsRequired) {
@Html.LabelFor(m => prop, @<em>(mandatory)</em>, prop.GetDisplayName())
} else {
@Html.Label(prop.PropertyName)
}
</div>
<div class="editor-field">
@Html.Editor(prop.PropertyName)
</div>
</div>
}
}