@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.
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
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.
Render Body and Section
I new Umbraco user and I am struggling with render.
, but
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
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.
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
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.0My render issues, I will find a way to fix it....
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
is working on a reply...