Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

I have the following problem. My ASP.NET website displays just the index.cshtml without the layout from the _Layout.cshtml.

Here is a simple code example:

_Layout.cshtml:

<!DOCTYPE html>
<html ng-app="myApp">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - Testpage</title>
    @Styles.Render("~/Content/css")
</head>
<body layout="column">
    <md-toolbar layout="row">
        Navigation
    </md-toolbar>
    <div class="container">
        <div ng-view> 
        </div>
    </div>
    @Scripts.Render("~/bundles/angular-material")
    @Scripts.Render("~/bundles/myapp")
    @RenderSection("scripts", required: false)
</body>
</html>

My bundles are defined as follows:

bundles.Add(new ScriptBundle("~/bundles/angular-material").Include(
                        "~/Scripts/angular.js",
                        "~/Scripts/angular-animate/angular-animate.js",
                        "~/Scripts/angular-aria/angular-aria.js",
                        "~/Scripts/angular-material/angular-material.js"));

bundles.Add(new ScriptBundle("~/bundles/myapp").Include(
                        "~/Scripts/App/app.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
                        "~/Content/bootstrap.css",
                        "~/Content/angular-material.css"));

And the Controller in my MVC:

public class HomeController : Controller
{
   public ActionResult Index()
   {
        return PartialView();
   }
}

And last the Index.cshtml:

@{
    ViewBag.Title = "Home Page";
}

<div class="jumbotron">
    <h1>ASP.NET</h1>
    <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
    <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>
</div>

Also the style of bootstrap doesn't work (e.g. class jumbotron). Does anyone have an idea where the problem is?

share|improve this question
    
Do you try to check if there's any error from chrome developer tools or any tools? – jomsk1e Aug 15 at 10:26
    
@jomsk1e Nothing is displayed – yuro Aug 15 at 10:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.