Domanda

I have a _ViewStart.cshtml in my main view folder with the following code.

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

In the View folder of my admin area I have a _ViewStart.cshtml with this code

@{
    Layout = Request.IsAjaxRequest() ? null : "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

I put a breakpoint on both lines of code, and when I go into the admin area I can see it hits the viewstart in that folder and not the one in the main folder. Even though it hits that code it still only uses the main layout.

È stato utile?

Soluzione

I didn't see it at first, but the specific view I was testing with was specifying the wrong layout, so no matter what I put anywhere else it was overwriting it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top