.net - Can an ASP.NET MVC PartialView have a _Layout -
can asp.net mvc partialview directly use layout?
msdn
i have looked @ msdn partialviewresult
, compared viewresult
:
viewresult
has property mastername
partialviewresult
not.
but.. can still define layout
property in partial views razor.
background
i remediating large code base huge amount of partial views used fill iframes. ideally converted normal views (ideally not use iframes) wondering adding layout these partials take out <head>
element @ least have more control on script versioning (everything replicated in each partial view). i'm looking light-touch solution since of code expected thrown away.
yes, in partial view
can set layout
property turns partial view
normal view
layout
.
@{ layout = "~/views/shared/_layout.cshtml"; }
Comments
Post a Comment