Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top