开发者

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

开发者 https://www.devze.com 2023-03-14 04:35 出处:网络
Is it possible that based on attributes on a property, instead of <div class=\"editor-label\"> @Html.LabelFor(model => model.PropertyName)开发者_运维百科

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

精彩评论

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

关注公众号