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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:25:38+00:00 2026-05-17T23:25:38+00:00

I have _Layout.cshtml defined for my mvc application, which is shown below: @inherits System.Web.Mvc.WebViewPage

  • 0

I have _Layout.cshtml defined for my mvc application, which is shown below:

@inherits System.Web.Mvc.WebViewPage
@using Webdiyer.WebControls.Mvc;

<html xmlns="http://www.w3.org/1999/xhtml">
<head>   
    @RenderSection("HeaderContent", false)
</head>

<body> 
    @RenderBody() 
</body>
</html>

On the page SomePage.cshtml, I have included the layout, and also included the partial rendering construction, because I want my _MailForm.cshtml to be rendered on this page:

@{
   View.Title = "page";
   Layout = "~/Views/Shared/_Layout.cshtml";
}

@Html.Partial("_MailForm")

My _MailForm.cshtml file looks following:

@inherits System.Web.Mvc.WebViewPage<CMS.Models.Mail.MailModel>

@section HeaderContent
{
    <script src="@Url.Content("~/Scripts/mail.js")" type="text/javascript"></script>
}

<form>...</form>

The HeaderContent section declared in _MailForm.cshtml, suppose to be rendered from _Layout.cshtml and load mail.js script. The script is actually not loaded and because of that my form logic is not working. If I move that HeaderContent section from _MailForm.cshtml to SomePage.cshtml, everything works because mvc loads the script.

But how to load that script from inside _MailForm.cshtml file?

Regards

  • 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-17T23:25:39+00:00Added an answer on May 17, 2026 at 11:25 pm

    Ok, I’ll rewrite here the comment written by @BuildStarted, which is actually answer for my question:

    “This is actually by design. The sections can only populate the direct parent. (…) the simplest method [to solve the issue] would be to combine all your javascript into a single file. That would decrease pageloads bandwidth and generally make it better for the end user as they have to load a javascript file only once…however that’s not the solution you’re looking for. Since the SomePage.cshtml file has the partial page hard-coded I would say including your required script in that page is ok for now. Also, it’s OK to put scripts in the body tag.”

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

Sidebar

Related Questions

I am using Tiles within my web-application. I have a standard-layout (standard.jsp) within the
How would I implement this: http://elliottkember.com/sexy_curls.html In a ASP.Net MVC 3 web application? My
I have a layout which uses min-width and works great. So I came to
I have a bunch of ASP.NET web pages (that have a standard layout) that
There is a requirement to have not-so-trivial dynamic list, each record of which consists
I have a layout which works fine. This layout contains several partials, which display
I have a layout which might be a bit unusual. The structure is the
I have a new web app that is packaged as a WAR as part
I have a login.jsp page which contains a login form. Once logged in the
i have a input tag which is non editable, but some times i need

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.