0

I have page which expend shared file located in Views\Shared_Layout.cshtml.

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - ActivityMaker</title>

    <environment names="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />
    </environment>
    <environment names="Staging,Production">
        <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
        <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
    </environment>
    @Html.ApplicationInsightsJavaScript(TelemetryConfiguration)
</head> 

How to load specific only for this page css link if all stylesheets located in shared file?

Rodion
  • 63
  • 11

1 Answers1

0

If I understrand your problem correctly, you can pass a variable to cshtml with ViewBag etc. and write a control to load css or not.

Also you can use client side approach with js or jquery.

Here are some links you may find useful:

  1. Removing css link
  2. Loading css files
Community
  • 1
  • 1
kizilsu
  • 431
  • 3
  • 13