This question is locked. New answers and comments are not allowed.
Justin Stuparitz
Top achievements
Rank 1
Justin Stuparitz
asked on 25 Jan 2010, 09:34 PM
I have a stylesheetregistrar in my master page:
<%=Html.Telerik().StyleSheetRegistrar()
.DefaultGroup(group => group.Add("Styles.css")
.Add("telerik.common.min.css")
.Add("telerik.web20.min.css"))
%>
in the head tag. It's failing whenever I re-route to a view that contains a partial view. I "re-routing" by call return View("SomeViewWithAPartial") or RedirectToAction. Both cause the error to be thrown.
What can I do?
Thanks,
Justin
<%=Html.Telerik().StyleSheetRegistrar()
.DefaultGroup(group => group.Add("Styles.css")
.Add("telerik.common.min.css")
.Add("telerik.web20.min.css"))
%>
in the head tag. It's failing whenever I re-route to a view that contains a partial view. I "re-routing" by call return View("SomeViewWithAPartial") or RedirectToAction. Both cause the error to be thrown.
What can I do?
Thanks,
Justin
6 Answers, 1 is accepted
0
Hi Justin Stuparitz,
This is a very strange issue. I guess something is causing the view to be rendered twice but I am not sure what. Could you please paste a bit more code in here?
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.
This is a very strange issue. I guess something is causing the view to be rendered twice but I am not sure what. Could you please paste a bit more code in here?
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
Justin Stuparitz
Top achievements
Rank 1
answered on 26 Jan 2010, 02:21 PM
| <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head id="Head1" runat="server"> |
| <title> |
| <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> |
| </title> |
| <%=Html.Telerik().StyleSheetRegistrar() |
| .DefaultGroup(group => group.Add("Styles.css") |
| .Add("telerik.common.min.css") |
| .Add("telerik.web20.min.css")) |
| %> |
| </head> |
| <body> |
| <div id="page"> |
| <div id="header"> |
| <div id="title"> |
| </div> |
| <div id="logindisplay"> |
| <% Html.RenderPartial("LogOnUserControl"); %> |
| </div> |
| </div> |
| <asp:ContentPlaceHolder ID="MainContent" runat="server" /> |
| <div id="footer"> |
| </div> |
| </div> |
| <%= Html.Telerik().ScriptRegistrar() %> |
| <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.validate.js")%>"></script> |
| <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/Flagship.js")%>"></script> |
| <asp:ContentPlaceHolder ID="LocalJavaScriptContent" runat="server" /> |
| </body> |
| </html> |
| <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> |
| <asp:Content ID="localJavascript" runat="server" ContentPlaceHolderID="LocalJavaScriptContent"> |
| </asp:Content> |
| <asp:Content ID="loginTitle" ContentPlaceHolderID="TitleContent" runat="server"> |
| Log On |
| </asp:Content> |
| <asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server"> |
| <h2>Log On</h2> |
| <% Html.RenderAction("LogOn", "Account"); %> |
| </asp:Content> |
Finally, here is the partial:
| <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> |
| <div> |
| <% if (TempData["HasError"] != null && (bool)TempData["HasError"] == true) |
| {%> |
| <DIV class=validation-summary-errors> |
| <UL><LI>The username or password is incorrect</LI></UL></DIV> |
| <% }%> |
| <% |
| using (Html.BeginForm("LogOn", "Account", FormMethod.Post)) |
| { %> |
| <div> |
| <p>Username <%= Html.TextBox("username")%></p> |
| <p>Password <%= Html.Password("password")%></p> |
| <p><input type="submit" value="Log On" /> |
| <%=Html.ActionLink("Forgot Password?", "ForgotPassword", "Account")%> |
| </p> |
| </div> |
| <% } %> |
| </div> |
The error occurs when using the actionlink from the master (or any where for that matter).
0
Hi Justin Stuparitz,
I think that calling RenderAction("LogOn", "Account") will try to render a full view not a partial one (hence the error from the StyleSheetRegistrar). Could you please verify this is not the case?
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.
I think that calling RenderAction("LogOn", "Account") will try to render a full view not a partial one (hence the error from the StyleSheetRegistrar). Could you please verify this is not the case?
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
Justin Stuparitz
Top achievements
Rank 1
answered on 26 Jan 2010, 02:48 PM
Hi Atanas,
It has the same effect. I changed it to:
<% Html.RenderPartial("LogOn"); %>
which I was using before and it's the same error.
It has the same effect. I changed it to:
<% Html.RenderPartial("LogOn"); %>
which I was using before and it's the same error.
0
Accepted
Hi Justin Stuparitz,
I still think this attempts to render the LogOn view. Please try renaming your partial view to see if it helps.
The exception you are seeing will occur only if the StyleSheetRegistrar is indeed rendered twice which means something is causing the master page to render twice in the same request.
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.
I still think this attempts to render the LogOn view. Please try renaming your partial view to see if it helps.
The exception you are seeing will occur only if the StyleSheetRegistrar is indeed rendered twice which means something is causing the master page to render twice in the same request.
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
Justin Stuparitz
Top achievements
Rank 1
answered on 26 Jan 2010, 03:02 PM
You got it! Thanks Atanas. That will teach me not to name by partials the same as a regular view.