ASP.Net MVC _Layout.cshtml更改不适用

时间:2017-11-05 13:42:47

标签: asp.net-mvc twitter-bootstrap

因此,我的应用程序的默认布局会创建一个指向主页的链接,我认为该链接由bootstrap或其中一个javascript文件决定。无论如何,这是我目前布局的代码:

布局代码

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - Delivery</title>
    <link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-collapse collapse">
            </div>
        </div>
    </div>

    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year - Delivery</p>
        </footer>
    </div>
</body>
</html>

我删除了所有对bootstrap和js文件的引用,我希望摆脱显示的链接,但每当我执行我的应用程序时,我最终会在我所做的视图之上:

页面代码运行时

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - Delivery</title>
    <link href="/Content/Site.css" rel="stylesheet" type="text/css" />
    <link href="/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/modernizr-2.6.2.js"></script>
</head>

除了布局文件之外还有其他地方我必须进行更改以便不运行吗?

编辑:

查看代码

@using System;
@using Dostava.Data.Models;

@model Dostava.Data.ViewModel.KorisnikViewModel
<!doctype html>
<html>
<head>
    <title>KorisnikMenu</title>
</head>
<body>
    <div class="welcome">
        Dobrodosli: <br />
        @Model.Korisnik.KorisnickoIme
    </div>
    <div class="menu">
        <div class="menubtn">
            <input type="button" value="Nova narudzba" onclick="location.href='/Home/Glavna'" />
        </div>
        <div class="menubtn">
            <input type="button" value="Obavijesti" onclick="location.href='/Home/Glavna'" />
        </div>
        <div class="menubtn">
            <input type="button" value="Izmjena podataka" onclick="location.href='/Home/Edit?id=@Model.Korisnik.Id'" />
        </div>
        <div class="menubtn">
            <input type="button" value="Log out" onclick="location.href='/Home/Glavna'" />
        </div>
     </div>

    <div class="filter">
        Pretraga narudžbi:
        <hr style="border:1px solid black;" />
        Aktivne   <input type="checkbox" value="Aktivne" /> 
        Zavrsene  <input type="checkbox" value="Zavrsene" />
        Na cekanju <input type="checkbox" value="NaCekanju" />
        Otkazane  <input type="checkbox" value="Otkazane" /> 
        Neuspjesne <input type="checkbox" value="Neuspjesne" />
        <input type="text" id="sifratxt" placeholder="Sifra narudzbe..."  style="width:20%;"/>
        <input type="button" id="filterbtn" value="Primjeni filter" style="width:20%;" />
    </div>
    <div class="narudzbe">
        <hr style="border:1px solid black;" />
        <p style="font-size:18px;">Vaše narudžbe:</p>
        <table class="tabela">
            <tr id="tabelatr">
                <td>Sifra Narudzbe</td>
                <td>Datum Narudzbe</td>
                <td>Primaoc</td>
                <td>Status Naruzdbe</td>
                <td>Cijena Narudzbe</td>
                <td>Detalji Narudzbe</td>
                <td>Otkazi</td>
            </tr>
            @foreach (Narudzbe n in Model.narudzbe)
            {
                <tr>
                    <td>@n.SifraNarudzbe</td>
                    <td>@n.DatumNarudzbe</td>
                    <td>@n.Primaoc.Ime @n.Primaoc.Prezime </td>
                    <td>@n.StatusNarudzbe.Naziv</td>
                    <td>@n.CijenaNarudzbe</td>
                    <td><input type="button" value="Detalji" onclick="location.href='/Home/DetaljiNarudzbe?id=@n.Id'"></td>
                    <td><input type="button" value="Otkazi" onclick="location.href='/Home/OtkaziNarudzbu?id=@n.Id'"></td>
                </tr>
            }
        </table>
    </div>
</body>
</html>

编辑2:

View_Start代码

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

1 个答案:

答案 0 :(得分:0)

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title> - Delivery</title>
   <link href="/Content/Site.css" rel="stylesheet" type="text/css" />
   <link href="/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
   <script src="/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
    <div class="container body-content">
        @RenderBody()
    </div>
</body>
</html>