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 6943917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:13:06+00:00 2026-05-27T13:13:06+00:00

In my asp.net MVC 3 application, I have nested layouts. I have followed following

  • 0

In my asp.net MVC 3 application, I have nested layouts. I have followed following link:

http://blogs.msdn.com/b/marcinon/archive/2010/12/15/razor-nested-layouts-and-redefined-sections.aspx

My main layout page is_MasterLayout.cshtml and then a nested layout page _fullLayout.cshtml. In _fullLayout.cshtml, I have:

@this.RedefineSection("BodyTitle")
@this.RedefineSection("Showcase")

but I am getting on these lines. Error is:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1928: ‘ASP._Page_Views_Shared__fullLayout_cshtml’ does not contain a definition for ‘RedefineSection’ and the best extension method overload ‘SectionExtensions.RedefineSection(System.Web.WebPages.WebPageBase, string)’ has some invalid arguments

Source Error:

Line 9:
Line 10: }
Line 11: @this.RedefineSection(“BodyTitle”)
Line 12: @this.RedefineSection(“Showcase”)
Line 13: @RenderBody()

my helper methods are defined like this:

public static class SectionExtensions
{

    private static readonly object _o = new object();

    public static HelperResult RenderSection(this WebPageBase page, string sectionName, Func<object, HelperResult> defaultContent)
    {
        if (page.IsSectionDefined(sectionName))
            return page.RenderSection(sectionName);
        else
            return defaultContent(_o);
    }

    public static HelperResult RedefineSection(this WebPageBase page, string sectionName)
    {
        return RedefineSection(page, sectionName, defaultContent: null);
    }

    public static HelperResult RedefineSection(this WebPageBase page, string sectionName, Func<object, HelperResult> defaultContent)
    {
        if (page.IsSectionDefined(sectionName))
            page.DefineSection(sectionName, () => page.Write(page.RenderSection(sectionName)));
        else if (defaultContent != null)
            page.DefineSection(sectionName, () => page.Write(defaultContent(_o)));
        return new HelperResult(_ => { });
    }

}

Please suggest solution.

Regards,
Asif Hameed

  • 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-27T13:13:07+00:00Added an answer on May 27, 2026 at 1:13 pm

    RedefineSection helper contains two or more argument

    RedefineSection(this WebPageBase page, string sectionName)
    

    but you are passing only one in your view

    @this.RedefineSection("BodyTitle")
    @this.RedefineSection("Showcase")
    

    According to

    http://blogs.msdn.com/b/marcinon/archive/2010/12/15/razor-nested-layouts-and-redefined-sections.aspx

    you have to put something

    @this.RedefineSection("TitleSection",
                      @<h1>Default SubLayout title</h1>)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my ASP .NET MVC application i have a link that refreshes the preview
In an ASP.NET MVC application where I have the following model.. public class EventViewModel
Let's say I have the following structure in my ASP.NET MVC 3 application. Items
In my ASP.NET MVC application I have the following GET input field: <% using
I have one question; In my ASP.NET MVC web application have to do certain
I have an ASP .NET MVC application, additonally I am using Knockout 2.0.0. I
I have an asp.net mvc application and I'm using Webgrid to list customers. I
I have an ASP.NET MVC application which sets up an Autofac IOCContainer within the
I have created a Asp.net MVC application. Now required 404 handling. Have updated global.asax
I have an ASP.NET MVC application using Authorization Attributes on Controllers and Actions. This

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.