Reputation: 761
Bootstrap is working in my index page and other pages which are by default generate....But the folder i create inside pages and scaffold using crud on those pages bootstrap is not working.....I tried the same thing in asp.net core 2 mvc template and it works fine.
Here is my create view
@page
@model Memberships.Pages.Section_Page.CreateModel
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Create</title>
</head>
<body>
<h4>Section</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form method="post">
<div asp-validation-summary="ModelOnly" class="text-danger">
</div>
<div class="form-group">
<label asp-for="Section.Title" class="control-label">
</label>
<input asp-for="Section.Title" class="form-control" />
<span asp-validation-for="Section.Title" class="text-
danger"></span>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-
success" />
</div>
</div>
</form>
</div>
</div>
<div>
<a asp-page="Index">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
</body>
</html>
Upvotes: 3
Views: 8404
Reputation: 33094
You're not refreshing Bootstrap in your <head>
so the page has no way of knowing you want to load it.
You need something along the lines of:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
Since it is working on other pages, I assume you've referenced the library from your _Layout.cshtml
(or some other shared layout). This layout won't be used however because you've explicitly told it not to load a layout:
@{
Layout = null;
}
Upvotes: 10