Copied to clipboard

Flag this post as spam?

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


  • Alaa 7 posts 47 karma points
    Sep 12, 2013 @ 15:02
    Alaa
    0

    Access content(Model) using Razor in template view and passing it to SurfaceController

    Hi,

    I'm new to umbraco and I know that my question is pretty basic but I can't find an answer to it, so please be patient.

    I'm having a trouble in understanding how can I use the content of a template/doctype in a view and to pass it to a SurfaceController.

    I've added a doctype and a template for it via umbraco back office and I got the basic cshtml file:

     

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @{

        Layout = null;

    }

     

    My doctype which is associated with this cshtml file has two properties "apikey" and "basekey" (they're not empty)

    When I try to access these properties using @Model.apikey I get an exception.

    What am I missing? how can I reach the content using Razor?

    I'd be more than happy if you can refer me to a site/touturial that answers my question.

     

    Thank Guys,

    Alaa 

  • Charles Afford 1163 posts 1709 karma points
    Sep 14, 2013 @ 12:12
    Charles Afford
    100

    Hi, can you show me what code you have tried so far?  You can get to the context node using @Model.Content....

    and then do .getProperty("apikey"); for example.  Hope this helps.

  • 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