【问题标题】:Change Default Html of Views更改视图的默认 Html
【发布时间】:2017-01-28 04:59:08
【问题描述】:

如何更改 html,以便所有新添加的视图(如编辑、详细信息、列表视图)都具有该 html 而不是默认 html。

例如而是默认html(下一个)

<h3>ListPage</h3>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.PO_PoolName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PO_Code)
        </th>
    </tr>
</table>

我想默认跟随 html

<h3 class="page-header">ListPage</h3> 
<div class="section-container section-with-top-border">

    <!-- begin panel -->
    <div class="panel pagination-inverse m-b-0 clearfix">
        <div class="row">
            <div class="col-lg-12">
                <span class="pull-right ">
                    <a href="/Pools/Create" class="btn btn-lime  btn-sm">
                        <i class="fa fa-fw fa-plus"></i>
                        Create New
                    </a>
                </span>
            </div>
        </div>
        <table id="data-table" data-order='[[1,"asc"]]' class="table table-bordered table-hover">
            <thead>
                <tr class="inverse">
                    <th>@Html.DisplayNameFor(model =>model.PO_PoolName)</th>
                    <th>@Html.DisplayNameFor(model => model.PO_Code)</th>
              </tr>
        </table>

提前致谢

【问题讨论】:

  • 请说明你想要什么,你的问题不清楚。你想要css,还是想要根据某些标准显示某些部分视图?你在这里说的默认是 css - 你没有显示 css,只显示 html
  • 我要更改视图的模板。
  • @user3079351,视图模板是什么意思?你想改变网页的布局吗?

标签: c# css asp.net-mvc asp.net-mvc-5


【解决方案1】:

我找到了解决办法

我修改并更改了下面目录中t4模板的html

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcView

这对我来说很好。

【讨论】:

    猜你喜欢
    • 2012-02-07
    • 1970-01-01
    • 1970-01-01
    • 2014-11-05
    • 1970-01-01
    • 2020-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多