This is a migrated thread and some comments may be shown as answers.
TabStrip, Razor, _Layout, LoadContentFrom & PartialView with _Layout
0 Answers 59 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andy McShane
Top achievements
Rank 1
Andy McShane asked on 24 Apr 2012, 12:57 PM
Hi all, I must be missing something simple here, I am trying to use a tabstrip and load my content dynamically using partial views. Now I am using the razor view engine. I have created a _Layout.cshtml file that contains my site header, a content area and a footer. Upon hitting the site my 'Home' controller 'Index' page is loaded which contains the tabstrip that I want to use. Each of the tabs uses the 'LoadContentFrom' to return other partial views. All of my partial views will have the same layout so I am trying to specify a different layout file in my views. However when I do this and I click a different tab I get the following error

'The "RenderBody" method has not been called for layout page "~/Views/Shared/_PageLayout.cshtml"'

How can I get my partial views to render the required layout. Below is an example of the tabstrip that I am using

<div id="tabBar">
    @{ Html.Telerik().TabStrip()
            .Name("TabStrip")
            .Items(parent =>
                       {
                           parent.Add()
                                .Text("Home Page")
                                .Selected(true)
                                .LoadContentFrom("Example", "Home", new { area = "" });
                            
                           parent.Add()
                               .Text("Configuration")
                               .LoadContentFrom("Index", "Base", new {area = "Configuration"});
 
                           parent.Add()
                               .Text("Questionnaire")
                               .LoadContentFrom("Index", "Base", new {area = "Questionnaire"});
 
                           parent.Add()
                               .Text("Display Text")
                               .LoadContentFrom("Index", "Base", new {area = "Text"});
 
                           parent.Add()
                               .Text("Media Management")
                               .LoadContentFrom("Index", "Base", new {area = "Media"});
 
                           parent.Add()
                               .Text("Administration")
                               .LoadContentFrom("Index", "Base", new {area = "Administration"});
                       })
            .Render(); }
</div>

How do I get my partial to render correctly without having to put the style inside each of my views?
Tags
TabStrip
Asked by
Andy McShane
Top achievements
Rank 1
Share this question
or