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

  • Home
  • SEARCH
  • 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 7666467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:50:23+00:00 2026-05-31T14:50:23+00:00

I have some base layout with site structure. In this default layout I define

  • 0

I have some base layout with site structure. In this default layout I define header tag, body structure and footer:

<html>
<head>...</head>
<body>
<div id="sidebar">...</div>
<div id="entry">@RenderSection("Entry", true)</div>
<div id="footer">...</div>
</body>

Each action in each controller defines in their view own entry section.

<!-- in View/Index.cshtml -->
@section Entry {
   Hello from Index action.
}

<!-- in View/Uploads.cshtml -->
@section Entry {
   Hello from Uploads action.
}

<!-- in View/Users.cshtml -->
@section Entry {
   Hello from Users action.
}

But I also want define different sidebars for each controller. If I put @RenderSection(“SideBar”, true) in main layout I must repeat sidebar code for each controllers action. I also can’t define sidebar design code in main layout because I want use different sibebars for each controller (but I want use same sidebar for each action in controller).

How can I solve this problem without repeating sidebar design code in each view?

I find solution https://stackoverflow.com/a/5573970 but it will be require duplication base site structure for each controller.

Thanks for answers and sorry for my bad english :(.

  • 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-05-31T14:50:24+00:00Added an answer on May 31, 2026 at 2:50 pm

    Put @RenderSection("SideBar", false)

    Then you can define the section for certain controller layouts only.

    You might want to define separate layouts for each controller and each view in this controller will use controller layout (where you can put your sidebar) instead of default layout. Controller layouts will use default layout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I declare some base styles for my site I have used to do
i have template base.html and some children templates. I don't know how to set
I have two questions regarding to html table layout. First I will provide some
For example, we have some CSS rules to define our form layout. We use
Lets say we have some basic AR model. class User < ActiveRecord::Base attr_accessible :firstname,
I have written some general functions to convert between decimal and any other base-n
I have a base class vehicle and some children classes like car, motorbike etc..
I have a base class for many tests that has some helper methods they
Assume some domain and view objects (that have no common base class) public class
I have multiple classes that all derive from a base class, now some of

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.