views:

73

answers:

1

When I installed ASP.NET MVC RC2, I noticed that the template had changed from RC1. Now, all new views have the header placeholder after the main content place holder. Why is this? It seems very illogical to me and it most definitely was not the case with RC1. I googled but couldn't find any reasoning for this change. Do you know of any?

Example:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Rules</h2>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>

Note how the placeholder with ContentPlaceHolderID of "head" is at the bottom? Weird...

+1  A: 

I can't say I noticed it when I upgraded, but it shouldn't matter. The two <asp:Content> sections get mapped by the ID property to their places as defined in Site.master.

Definitely check the order in Site.master, but it should be fine.

If you want to change this, you can look into the T4 template your views are using. Check out:

http://haacked.com/archive/2009/01/31/t4-templates-in-asp.net-mvc.aspx

http://blogs.msdn.com/webdevtools/archive/2009/01/29/t4-templates-a-quick-start-guide-for-asp-net-mvc-developers.aspx

http://codebetter.com/blogs/david.hayden/archive/2009/01/29/overriding-global-t4-templates-in-asp-net-mvc-project-with-per-project-templates.aspx

JMs