开发者

Is it possible to override MVC View Scaffolding on a property basis?

Is it possible that based on attributes on a property, instead of

<div class="editor-label">
    @Html.LabelFor(model => model.PropertyName)开发者_运维百科
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.PropertyName)
    @Html.ValidationMessageFor(model => model.PropertyName)
</div>

the following gets scaffolded

   <div class="editor-label">
        @Html.LabelFor(model => model.PropertyName)
    </div>
    <div class="editor-field-tall">
        @Html.TextAreaFor(model => model.PropertyName, new { @rows = 5, @cols = 40 })
        @Html.ValidationMessageFor(model => model.PropertyName)
    </div>

without rewriting, replacing, or copying into a new TT and then extending the mvc scaffolding templates?


without rewriting, replacing, or copying into a new TT and then extending the mvc scaffolding templates?

No.

If you want to write your own mvc scaffolding templates, I would read this post which will cover how you can override the T4 templates..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜