Copied to clipboard

Flag this post as spam?

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


  • Bert 128 posts 251 karma points
    Nov 09, 2011 @ 12:43
    Bert
    0

    Renderpage from within template

    I got an inline razor script in my template. This inline script should call a scripting file.

    So basicly is I have the template:

    ...
    <umbraco:Macro runat="server" language="cshtml">
    ...
    @RenderPage("list.cshtml");
    </umbraco:Macro>
    ...

    and an empty scriptfile (to minimize error possibilities)

    This gives the error:

    Error Loading Razor Script (file: ) The file "~/App_Data/TEMP/Razor/list.cshtml" could not be rendered, because it does not exist or is not a valid page.    at System.Web.WebPages.Util.EnsureValidPageType(WebPageBase page, String virtualPath)

     

     

  • Owen 123 posts 246 karma points
    Nov 09, 2011 @ 13:45
    Owen
    0

    try this one:

    @RenderPage("~/macroscripts/list.cshtml")

    And put file(list.cshtml) into macroscripts folder

  • Bert 128 posts 251 karma points
    Nov 09, 2011 @ 13:50
    Bert
    0

    Great :-) I indeed needed to put the path to the file in there. Is it me but shouldn't that be resolved by umbraco?

  • Owen 123 posts 246 karma points
    Nov 09, 2011 @ 14:02
    Owen
    0

    I think the reason is you use inline razor macro. all the inline macro(razor) will store in the ~/App_Data/TEMP/Razor. So the engine will treat this folder as default folder.

    If you use a normal macro(Not inline), and you don't need to point out the file path.

  • 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