barteloma
barteloma

Reputation: 6875

Asp.net mvc aspx view and razor view transform

I am developing my MVC projects using the razor view engine. I have an application that was created with the aspx view engine. So I cannot understand the difference between certain elements.

Aspx views have contentplaceholders and contents. What is the equivalent in razor?

<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleContent" runat="server">
    <asp:ContentPlaceHolder ID="TitleContent” runat="server">
    </asp:ContentPlaceHolder>
</asp:Content>

Upvotes: 0

Views: 262

Answers (1)

levelnis
levelnis

Reputation: 7705

The Razor equivalent of content tags is sections. The code above in Razor would look like this:

@section TitleContent {
    @RenderSection("TitleContent", true) @* true makes this section required in any views that use this layout *@
}

Upvotes: 0

Related Questions