Dandy
Dandy

Reputation: 272

How do I nest layouts with ServiceStack.Razor?

Given the following directory structure (to keep it simple):

/
  _Layout.cshtml
  _SubLayout.cshtml
  default.cshtml
  sub.cshtml

And contents:

sub.cshtml

@inherits ServiceStack.Razor.ViewPage
@{Layout = "_SubLayout";}
<div>In the sub folder.</div>

_SubLayout.cshtml

@inherits ServiceStack.Razor.ViewPage
@{Layout = "_Layout";}
<div>This is a page from a sub section:</div>
@RenderBody()

How can I render the _SubLayout.cshtml view within the _Layout.cshtml view when a request is made for sub.cshtml? When I do this now only the _SubLayout.cshtml is used.

Upvotes: 1

Views: 201

Answers (1)

Ermias Y
Ermias Y

Reputation: 263

This is supported in ServiceStack 3.9.54

Upvotes: 2

Related Questions