Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:25:14+00:00 2026-06-09T03:25:14+00:00

I known There is a default _Layout.cshtml file in Asp.net MVC just like MasterPage

  • 0

I known There is a default _Layout.cshtml file in Asp.net MVC just like MasterPage in Asp.net Web Site. Can I define multiple layout templates in my MVC app? If so ,How to make it? Please give me some code example . Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:25:15+00:00Added an answer on June 9, 2026 at 3:25 am

    You can create multiple Layout pages and use it in differnt views. You may mention the new layout pages inside your views by mentioning the Layout property in your views.

    Create a new View and name it as _AdminLayout.cshtml under Views/Shared folder. You may create your HTML markup for your master page template there. Make sure you have @RenderBody() section in your Layout page so that the content of your normal views will be replaced here when it renders.

    <html>
      <head>
      </head>
      <body>
          <h1>My new Layout</h1>
          @RenderBody()
      </body>
    </html>
    

    And if you want to use this Layout in a view, you can do it like this

    @{
      Layout = "~/Views/Shared/_AdminLayout.cshtml";
    }
    <p>The content here will be present inside the render body section of layout</p>
    

    If you want to use the new Layout for all the Views by default without explicitly mentioning like the above code, you can do it in the Views/_ViewStart.cshtml file

    @{
        Layout = "~/Views/Shared/_AdminLayout.cshtml";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any known issues with ASP.Net Ajax and IE6 in Windows 2000 machines
In default mvc app. There are Layout and content pages, You know (_Layout, Home,
Are there any known design principles, best-practices and design patterns that one can follow
For any given type i want to know its default value. In C#, there
It seems to be well-known there is a bug when using JMenuItem.getRootPane(). I read
Are there known issues with storing user defined types within index organized tables in
I've already known that there is an interface in UIWebView for object c to
Is there any known attack on this modified version of Yahalom? Cannot find anything...
Are there any known regular expressions out there to validate credit card track 1
Is there any known hashing algorithm, which for similar input returns similar output? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.