Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kim Schurmann 15 posts 135 karma points c-trib
    Jun 20, 2013 @ 11:33
    Kim Schurmann
    0

    Error rendering template (missing controller)

    Hi there,

    I am trying to render a template but is stuck with this error:

    <!-- Error rendering template with id 1080: 'System.ArgumentNullException: Value cannot be null.Parameter name: controller at System.Web.Mvc.ControllerContext..ctor(RequestContext requestContext, ControllerBase controller)   at Umbraco.Web.Templates.TemplateRenderer.ExecuteTemplateRendering(TextWriter sw, PublishedContentRequest contentRequest)   at Umbraco.Web.Templates.TemplateRenderer.Render(StringWriter writer)   at Umbraco.Web.UmbracoHelper.RenderTemplate(Int32 pageId, Nullable`1 altTemplateId)' -->

    The ID is correct, and I am trying to render it using this:

    @Umbraco.RenderTemplate(1080)

    The DocType is ContentWidget and I have a ContentWidgetController (have tried with both a SurfaceController and ordinary Controller).

    From dotpeek I have discovered that this property is null:
    umbracoRouteDefinition.Controller

    Any help would be greatly appreciated :-)

    Thanks in advance!

     

  • HC Saustrup 28 posts 79 karma points
    Jun 20, 2013 @ 14:29
    HC Saustrup
    0

    I just experienced the same issue with Umbraco 6.1.1.

  • HC Saustrup 28 posts 79 karma points
    Jun 20, 2013 @ 15:27
    HC Saustrup
    100

    Suggested solution is to use @Html.Partial instead: http://issues.umbraco.org/issue/U4-1174#comment=67-3664

  • Kim Schurmann 15 posts 135 karma points c-trib
    Jun 20, 2013 @ 16:09
    Kim Schurmann
    0

    Thanks alot - it's working like a charm! 

  • Razvan 36 posts 67 karma points
    Jun 29, 2013 @ 12:28
    Razvan
    0

    I have the same problem, but the above solution does not work for me because I need to render the page in code (not in views/template).

    The ugly solution for me was to download the page

    WebClient client = new WebClient();
    string body = client.DownloadString(library.NiceUrlWithDomain(contentId));
  • Sandor 13 posts 36 karma points
    Jul 05, 2013 @ 22:25
    Sandor
    0

    Same here. I have a module that does some checks and returns the html of some arbitrary node. Currently I am using the application.PreRequestHandlerExecute event to do the checks. Could it be that some MVC plumbing is not in place yet during this event?

    Though ugly I might have to go with @Razvan's solution for the time being...don't like internal request though.

    S

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies