In the head section of your layout page, add a
RenderSection("head")
call. Then, in your Razor view, add
@section head {
@myincludemarkup
}
Where "myincludemarkup" of course is the html markup of your script/stylesheet references.
edit:
The section in your layout page (master page) could look something like this:
<head>
@RenderSection("head")
</head>
This would force each and everyone of your views to define a section called "head" by writing the code at the top of my answer, @section etc.
If you want the section optional in your viewpages, you can write
<head>
@RenderSection("head", optional:true)
</head>
Use this page for reference:
http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx
edit: to use your own code:
@inherits System.Web.Mvc.WebViewPage<dynamic>
@using Razor
@using Razor.Models
@{
View.Title = "Index";
LayoutPage = "~/Views/Shared/_Layout.cshtml";
}
<h2>@View.Message</h2>
@{
UserManager.product prod = UserManager.getUserinfo();
}
@prod.Price
@prod.Title
@prod.ID
<h2></h2>
@section head {
@myincludemarkup
}