Copied to clipboard

Flag this post as spam?

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


  • Richard Kingston 46 posts 69 karma points
    Mar 07, 2015 @ 22:24
    Richard Kingston
    0

    Limited options on @Model object?

    Hi,

    Working in a template file that inherits from Umbraco.Web.Mvc.UmbracoTemplatePage I seem to have really limited methods and properties available to me on the @Model object.

    Under @Model.Content for example, I don't have any of the Ancestor or Descendant methods, just Children().

    I feel like I'm missing something really obvious but as a bit of a noob could use a nudge.

    Cheers

    Rich

  • Richard Kingston 46 posts 69 karma points
    Mar 07, 2015 @ 22:41
    Richard Kingston
    1

    OK, so looking into the Umbraco.Core.dll file told me that I need to add the following line to the top of my View, above the inherits line.

    using Umbraco.Web;

    Seems to have solved the problem, but if anyone in the know wants to set me straight, please do :) Still very much learning my way around v7.

    Cheers

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 09, 2015 @ 12:14
    Jeroen Breuer
    0

    Hello,

    You're right. Adding the Umbraco.Web namespace gives you most of these extra methods. You could also add the Umbraco.Core namespace which adds a lot of other useful extension methods.

    Jeroen

  • Richard Kingston 46 posts 69 karma points
    Mar 09, 2015 @ 16:22
    Richard Kingston
    0

    Thanks Jeroen, appreciate the reassurance :)

Please Sign in or register to post replies

Write your reply to:

Draft