ContentPlaceHolder in Razor?

前端 未结 2 747
长发绾君心
长发绾君心 2020-12-05 12:49

I can use ContentPlaceHolder\'s with Webforms view engines to put stuff in different locations in the master page.

How do I do that with Razor?

    &         


        
2条回答
  •  一个人的身影
    2020-12-05 13:23

    Yet again I managed to ask before finding the correct search keywords in Google.

    In the layout

    @RenderSection("footer", required: false)  
    

    View example

    About

    Some stuff about this page.

    The current date and time: @DateTime.Now

    @section footer { Copyright (c) 2010, Robert Sundström. }

提交回复
热议问题