MVC 4页面没有附加到新的_Layout

时间:2017-05-11 15:26:51

标签: asp.net asp.net-mvc-4

我找不到与我的问题有关的任何问题。

此外,我是一个新的(再次)MVC结构,因为我花了很长时间。

无论如何,我创建了一个新的布局文件 _Layoutwithtop.cshtml 。尽管About.cshtml和Contact.cshtml没有,但Index.cshtml采用的布局很好。

我将需要所有未来的View文件继承_Layoutwithtop。这是我的附件。是的,我已经包含了@Layout =“〜/ Views / Shared / _Layoutwithtop.cshtml”;关于和联系页面中的行。

感谢。

_Layoutwithtop.cshtml

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    <meta charset="UTF-8">
    <meta content="Great Lakes Imaging carries new and pre-owned radiology and x-ray imaging equipment for Chiropractors, Medical offices and Veterinary clinics. Offering a wide variety of top brands in the industry, we help you find the right equipment for your practice." name="description">
    <meta content="Kodak POC 140, AGFA CR 30X, Bennett, HCMI, digital x-ray, film processor, x-ray parts, xray accessories, technique chart, radiation, xray equipment, xray companies" name="keywords">
    <link href="Content/bootstrap.min.css" rel="stylesheet">
    <link href="Content/Site.css" rel="stylesheet">
    <link href="Content/animate.min.css" rel="stylesheet">
    <link href="Content/assets/icons/icons.css" rel="stylesheet">
    <link href="Content/owl.theme.css" rel="stylesheet">
    <link href="Content/owl.carousel.css" rel="stylesheet">
    <link href="Content/nivo-lightbox.css" rel="stylesheet">
    <link href="Content/nivo_themes/default/default.css" rel="stylesheet">
    <link href="Content/styles.css" rel="stylesheet">
    <link href="Content/responsive.css" rel="stylesheet">
    <link href="Content/colors/blue.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:200" rel="stylesheet">
</head>
<body>

<div class="preloader">
    <div class="status"></div>
    &nbsp;
</div>

<div>
    @RenderBody()
</div>
<!--  footer  -->
    @Html.Partial("_footer")
<!--  / footer  -->

    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)

<!--  scripts  -->
    <script src="Scripts/jquery.min.js"></script>
    <script>jQuery(window).load(function(){"use strict";jQuery(".status").fadeOut(),jQuery(".preloader").delay(1e3).fadeOut("slow")})</script>
    <script src="Scripts/smoothscroll.js"></script>
    <script src="Scripts/bootstrap.min.js"></script>
    <script src="Scripts/jquery.nav.js"></script>
    <script src="Scripts/wow.min.js"></script>
    <script src="Scripts/nivo-lightbox.min.js"></script>
    <script src="Scripts/owl.carousel.min.js"></script>
    <script src="Scripts/jquery.stellar.min.js"></script>
    <script src="Scripts/jquery.ajaxchimp.min.js"></script>
    <script src="https://maps.googleapis.com/maps/api/js"></script>
    <script src="Scripts/custom.js"></script>
<!--  / scripts -->
</body>
</html>

Index.cshtml

@{
    ViewBag.Title = "Home Page | Great Lakes Imaging, Inc.";
    Layout = "~/Views/Shared/_Layoutwithtop.cshtml";  
}

<header class="header data-stellar-background-ratio=0.5" id="home">
    <div class="overlay-layer">
        <div class="navbar bs-docs-nav navbar-fixed-top sticky-navigation" role="navigation">
            <div class="container">
                <!--- nav header --->
                <div class="navbar-header">
                    <button class="navbar-toggle" data-target="#stamp-navigation" data-toggle="collapse" type="button">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-grid-2x2"></span>
                    </button>
                    <a href="#" class="navbar-brand">Great Lakes Imaging, Inc.</a>
                </div>
            </div>
        </div>
        <!--- main home wrapper --->
        <div class="container">
            <div class="only-logo">
                <div class="navbar">
                    <div class="navbar-header">
                        <img alt="Great Lakes Imaging Main Logo" src="images/newGLITranswhite.png">
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <div class="intro-section">
                        <h1 class="white-text intro">Your #1 source for digital x-ray equipment</h1>
                        <h5 class="white-text">We just happen to have 100 + chiropractic tables, too</h5>
                        <div class="button"><a href="http://shop.greatlakesimaging.com" class="btn standard-button inpage-scroll btn-primary" target="_blank">Browse all of our equipment</a></div>
                    </div>
                </div>
            </div>
        </div>
        <!--- /main home wrapper --->
    </div>
</header>


@Html.Partial("_Menu")

_ViewStart.cshtml

@{
    Layout = "~/Views/Shared/_Layoutwithtop.cshtml";
}

0 个答案:

没有答案