Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Elisabeta Scriba 3 posts 72 karma points
    Jul 23, 2019 @ 17:02
    Elisabeta Scriba
    0

    Render Body and Section

    I new Umbraco user and I am struggling with render. My Master.cshtml doesn't support RenderBody() or RenderSection()

    , but I need a RenderSection for my custom page that inherits my Master

    In conclusion, if I don't delete the render section from master I am getting an error, If I delete it, I will get another error on my another view

    What to do

  • David Challener 80 posts 444 karma points c-trib
    Jul 24, 2019 @ 08:39
    David Challener
    0

    Hi Elisabeta,

    @RenderSection designates a place for where content will be rendered that is different from RenderBody() when the template (in this case Master.cshtml) is inherited. This is actually asp.net MVC Razor syntax if you want to learn more about them.

    As you've seen, if you have RenderBody and/or RenderSection on the template you won't be able to use this template directly for your content, but instead should have a template that inherits from it or more precisely, has the following at the top of the file.

    @{
        Layout = "Master.cshtml";
    }
    

    If you've inherited this solution, I would check to see if there are any other templates that have this code at the top and try to use this template for the content you're trying to view. If you're already done this and you're getting a different error, then paste that in here and see what is going on.

    If you can say what page (content) you're trying to view, and the template that is assigned to it that will help diagnose issues.

    HTH, David

  • Elisabeta Scriba 3 posts 72 karma points
    Jul 24, 2019 @ 11:10
    Elisabeta Scriba
    0

    Hello David, I have my own custom view that inherits the Master, and I do have Layout = "Master.cstml", but as I have seen it's not so easy to work with them. Still got errors that I shouldn't get, I have seen your tutorials and all free videos from umbraco.tv, but still confused. Anyway I also want to report a bug, if I create a MVC project or an empty project but checking the MVC under the "Add folder and references for:" area, I am getting double<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></system.web.webPages.razor> one with this version and another with 5.2.4.0

    My render issues, I will find a way to fix it....

  • David Challener 80 posts 444 karma points c-trib
    Jul 24, 2019 @ 11:34
    David Challener
    100

    Hello Elisabeta,

    Ok, it sounds like it's close. If it is just the renderSection causing you an issue, you can temporarily remove it AND remove the @section scripts from the custom view to help diagnose further.

    On the other issue, I personally always start with an empty project then use nuget to install the umbracocms package.

    Starting with the MVC project nearly always means you have to delete a bunch of files to get started and like you say means you need to make sure the right references are in.

    Many thanks, David

Please Sign in or register to post replies

Write your reply to:

Draft