Copied to clipboard

Flag this post as spam?

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


  • Jacob 41 posts 90 karma points
    Jan 10, 2014 @ 23:21
    Jacob
    0

    Razor syntax is not being recognized from the Edit template page.

    Hello all,

    My name is Jacob, and I'm working on an MVC project that utilizes Umbraco CMS.   I've been through several videos and documentation regarding this issue, and thus far I've found nothing helpful.  I've even stepped though the process outlined on the following video and I'm experiencing behavior not included in the video: http://umbraco.tv/videos/developer/fundamentals/surface-controllers/the-surface-controller/

    Basically, I'm trying to render a partial view from my main Home template; however, Razor syntax is not being recognized on this template, and Umbraco is instead rendering my command @Html.Partial("_UserLoginPartial") as plain text.  On the partial view template itself I see that the @ sign is highlighted yellow and Umbraco is correctly performing razor commands, but on my home template it only seems to recognize <asp:></asp:> commands.

    Does anyone have any experience, advice, or input on this matter?

    Thank you in advance.


    Jacob

  • Jacob 41 posts 90 karma points
    Jan 13, 2014 @ 16:16
    Jacob
    0

    So for the time being I've circumvented this issue by using an Umbraco Partial Macro.  I'm still having a few issues trying to get the form on the partial macro to postback to the appropriate controller though.

  • Jacob 41 posts 90 karma points
    Jan 14, 2014 @ 02:59
    Jacob
    0

    For future users who may have similar issues,

    I was able to resolve my original problem by altering the razor html helper syntax to accomodate for Umbraco's routing system.

    For example, when attempting to call a controller from an Umbraco template one may consider the following to be standard MVC Razor syntax:

    @Html.Action("ActionName","ExampleSurfaceController")

    However, that code was not working in my environment.  I was not able to get Umbraco to route to the appropriate surface controller until I removed "Controller" from the string, resulting in:

    @Html.Action("ActionName","ExampleSurface")

     

    This was terribly confusing, and it wasn't until watching one of the videos on surface controllers about 10 times until it dawned on me. Hope this helps someone.

Please Sign in or register to post replies

Write your reply to:

Draft