I have nested templates. My _Basic templates has @RenderBody() and similary my Child template also has @RenderBody()
I don't want to use _Basic tmeplates as layout for views. I understand multiple @Section can be defined in a layouts but why I cant use @RenderBody() in both parent and child layout as well.
If I m not wrong it is allowed in Razor but why I can't do it in Razor with Umbraco. I tried and was getting the following error:
The "RenderBody" method has not been called for layout page "~/Views/Child.cshtml".
Thanks Dennis, I have checked these resources but still I have question. Why in Umbraco I can't use template with @RenderBody() directly in a Content ? Kindly guide.
Nested layout pages and RenderBody()
I have nested templates. My _Basic templates has @RenderBody() and similary my Child template also has @RenderBody()
I don't want to use _Basic tmeplates as layout for views. I understand multiple @Section can be defined in a layouts but why I cant use @RenderBody() in both parent and child layout as well.
If I m not wrong it is allowed in Razor but why I can't do it in Razor with Umbraco. I tried and was getting the following error:
Hi Haansi,
I think that you should try to see this video chapter about templates, they are explain the @RenderBody() http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/advanced-master-templates/
Maybe this blogpost from Umbraco can help you too. http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx and http://our.umbraco.org/documentation/cheatsheets/masterpagestoviews#Contentplaceholder
Hope this helps,
/Dennis
Thanks Dennis, I have checked these resources but still I have question. Why in Umbraco I can't use template with
@RenderBody()
directly in aContent
? Kindly guide.Hi Haansi.
You can compare the RenderBody() with the the ContentPlaceHolder in master page. A layout page can have only one RenderBody method.
Try to see this article: http://www.dotnet-tricks.com/Tutorial/mvc/9Ya6290314-Layouts,-RenderBody,-RenderSection-and-RenderPage-in-ASP.NET-MVC.html
Hope this helps,
/Dennis
For anyone else that comes across this issue, I found the answer provided a bit more directly here - http://stackoverflow.com/a/8579238/250254
is working on a reply...