0

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>

1 Answer 1

0

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 *@
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.