views:

94

answers:

1

Hello,

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"&gt;
<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