Aida E
Aida E

Reputation: 1100

asp.net mvc : multiple layout

I have a main layout(layout1) of my website as a start page and now I want to add another page(layout) that gets some information from user and then after saving the information in database render the main layout.

right now in start page :

   Layout = "~/Views/Shared/_Layout.cshtml";

and in layout :

  <div id="main" class="container">
            @RenderBody()
            @RenderSection("~/Views/AskGroup/_Layout1.cshtml");}
        </div>

the error : Section not defined: "~/Views/AskGroup/_Layout1.cshtml". how should I add thid layout1 to the layout page? do I need to add a controller as well ?

Upvotes: 0

Views: 429

Answers (1)

Mike Perrenoud
Mike Perrenoud

Reputation: 67898

Since it's basic HTML content, use RenderPartial instead:

@Html.RenderPartial("_Layout1.cshtml");

Upvotes: 1

Related Questions