This is a migrated thread and some comments may be shown as answers.

[Solved] You cannot call render more than once

4 Answers 197 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jim
Top achievements
Rank 1
Jim asked on 28 Jan 2010, 01:18 AM
This is a bit dificult to explain and involves both the panel bar and tab control.  I have an action link in a panel bar control that loads a view into the main content placeholder of a master page.  The view has a tab control on it.  One tab is to load a partial view into the tab content area, but whenever I run the application I get an InvalidOperationException that says "You cannot call render more than once".  The error appears here
    <%   
    Html.Telerik().StyleSheetRegistrar()  
        .DefaultGroup(group => group.Add("telerik.common.css")  
                                    .Add("telerik.black.css"))  
        .Render()  
    ;   
    %> 
 
 The code that causes the error is:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">  
    <% Html.RenderPartial("BlogEntries"); %> 
</asp:Content> 
 
Can you explain this or help me fix it?

Thanks,
Jim

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 28 Jan 2010, 08:17 AM
Hi Jim,

There is a very similar forum thread which you can check.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tx3
Top achievements
Rank 1
answered on 29 Jan 2010, 09:51 AM
I have exactly same error (You cannot call render more than once) on my Master page. I am trying to implement PanelBar as my navigation control. I have been banging my head to the wall, maybe someone has an idea how to fix this? :)

Here is my master page. Problem occurs when I use RenderPartial("Navigation");

<head runat="server">  
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>  
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> 
    <%   
        Html.Telerik().StyleSheetRegistrar()  
            .DefaultGroup(group => group.Add("telerik.common.css")  
                                        .Add("telerik.vista.css"))  
            .Render();   
    %>      
</head> 
 
<body> 
    <div class="page">  
        <form id="navigationForm" runat="server">  
            <div id="container">  
                <div id="top">  
                    <div id="logindisplay">  
                        <% Html.RenderPartial("LoginStatus"); %> 
                    </div>                       
                </div> 
                  
                <div id="leftnav">  
                    <% Html.RenderPartial("Navigation"); %> 
                    <asp:ContentPlaceHolder ID="NavigationContent" runat="server" /> 
                </div> 
                <div id="content">  
                    <asp:ContentPlaceHolder ID="MainContent" runat="server" /> 
                 </div> 
                <div id="footer">  
                </div> 
            </div>          
        </form> 
    </div> 
    <%= Html.Telerik().ScriptRegistrar() %> 
</body> 
</html> 
 

Navigation.aspx (I tried also without .Render(); but no luck)
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 
 
<asp:Content ID="Navigation" ContentPlaceHolderID="NavigationContent" runat="server">  
    <%   
        Html.Telerik().PanelBar()  
            .Name("PanelBar")  
            .Items(items => 
            {  
                items.Add().Text("Item 1");  
                items.Add().Text("Item 2");  
            })  
            .Render();  
    %> 
</asp:Content> 

NavigationController
namespace ParKone.Controllers  
{  
    public class NavigationController : Controller  
    {  
        //  
        // GET: /Navigation/  
 
        public ActionResult Index()  
        {  
            return View();  
        }  
 
    }  
0
Atanas Korchev
Telerik team
answered on 29 Jan 2010, 09:57 AM
Hi Tatu Tamminen,

The problem is that you are using RenderPartial with a view not partial view. Your Navigation.aspx has its master page set to the same master page you have the RenderPartial. The solution is to make Navigation.aspx a real partial view (ascx file).

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tx3
Top achievements
Rank 1
answered on 29 Jan 2010, 11:51 AM
Excellent! I got working now.

This was very useful thread when I tried to get binding to the sitemap working. http://www.telerik.com/community/forums/aspnet-mvc/general/menu-bind-sitemap-inside-a-masterpage.aspx

Those examples have too much information for those are learning MVC and Telerik controls. :)

Thanks for the help
Tags
PanelBar
Asked by
Jim
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Tx3
Top achievements
Rank 1
Share this question
or