-1

有一个 mvc 应用程序,我试图在预编译的 CSHTML 页面(Index.cshtml)中进行修改

@using System.Web.Mvc.Html
@model Services.Admin.ViewModels.IndexViewModel
@{
Layout = "~/Views/Admin/_Layout.cshtml";
ViewBag.Title = Resources.AdminResources.Index_Title;
}
<div class="container">
<div class="masonry">
    <div class="item col-lg-4 col-md-4 col-sm-4">
        <h3>Event Clinics</h3>
        <table class="table table-striped table-bordered table-hover">
            <tbody>
            <tr>
                <td class="max-width">
                    @Html.ActionLink("Premier Instructors", "Index", "PremierInstructor")
                </td>
                <td></td>
            </tr>
            <tr>
                <td class="max-width">
                    @Html.ActionLink("Reports", "Index", "Reports")
                </td>
                <td></td>
            </tr>
            <tr>
                <td class="max-width">
                    @Html.ActionLink("Users", "Index", "Users")
                </td>
                <td></td>
            </tr>
            </tbody>
        </table>
    </div>   
</div>

这里还有各自的 Index.generated.cs,其中所有代码都是在“WriteLiteral”的帮助下编写的。

当我尝试以 .cshtml 形式添加/修改时,它的影响未显示在 UI 上。

我还在各种网站上找到了这些 cshtml 已经使用“RazorGenerator”工具编译的信息。

现在我的问题是,当我要对这种类型的 cshtml 文件进行任何更改时,它不会反映在屏幕上。

4

1 回答 1

0

如果是基于 RazorGenerator 的预编译 .cshtml 表单,因为需要修改它的 html,然后按照以下步骤操作。

  1. 右键单击 .chstml 文件(例如 index.cshtml)。
  2. 点击“属性”。
  3. 在“高级”部分下,从“自定义工具”选项中删除“RazorGenerator”。
  4. 在 CSHTML 文件中进行更改。
  5. 再次遵循上述 1,2 步骤。
  6. 在“高级”部分下,在“自定义工具”选项中添加“RazorGenerator”。
  7. 保存表单并运行它。

现在您将看到 UI 中的所有更改。

于 2017-01-16T10:57:40.030 回答