Copied to clipboard

Flag this post as spam?

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


  • karen 186 posts 461 karma points
    May 15, 2014 @ 19:33
    karen
    0

    inherits ???

    These all say to use

    @inherits Umbraco.Core.Mvc.UmbracoTemplatePage

    but when I create a template in Umbraco UI it uses:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    if I try to change the Web to Core, then it errors: 

    The type or namespace name 'Mvc' does not exist in the namespace 'Umbraco.Core' (are you missing an assembly reference?)

    Yes I am including Umbraco.Core as a reference, I don't even see any Mvc in Umbraco.Core.

    (looking at v6.1.6 )

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    May 15, 2014 @ 23:48
    Jan Skovgaard
    0

    Hi Karen

    You should use the namespace that Umbraco creates by default when creating a template.

    The cheat sheet you're looking at is for Umbraco 4.7.1 - The one you should look at is this one for 6.1.x http://our.umbraco.org/projects/developer-tools/umbraco-v6-mvc-razor-cheatsheets

    Hope this helps.

    /Jan

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    May 16, 2014 @ 00:21
    Nicholas Westby
    1

    I use @inherits Umbraco.Web.Mvc.UmbracoTemplatePage, which works fine for me. You shouldn't need to add any references if your view are in the same website as Umbraco (and assuming you are using a website rather than web application as they are termed in Visual Studio).

    If you are still having trouble, try qualifying it with the global namespace: @inherits global::Umbraco.Web.Mvc.UmbracoTemplatePage.

    Also, FYI, Umbraco.Web.Mvc.UmbracoTemplatePage exists in the assembly umbraco.dll.

  • karen 186 posts 461 karma points
    May 16, 2014 @ 22:43
    karen
    0

    Hi

    Jan - Actually the cheatsheet I am looking at says at the top "Umbraco v6.x Razor Cheatsheet", so it is the correct one.

    Nicholas - I am using "@inherits Umbraco.Web.Mvc.UmbracoTemplatePage" because that is what was put there when I created the template via the UI.  It is working, but I am trying to learn the Umbraco MVC stuff, so took a look at these.  Checked out umbraco.dll and see the umbraco.web.. 

    Thanks.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    May 16, 2014 @ 22:47
    Jan Skovgaard
    0

    Hi Karen

    Aaah, it's just because the path of this post links to the 4.7 cheatsheet so I thought it was perhaps the wrong one. My bad :)

    /Jan

  • karen 186 posts 461 karma points
    May 17, 2014 @ 00:04
    karen
    0

    You are right!  I didn't even realize I was posting this in the wrong place.

    Hmm, looks like the other one doesn't even have a forum.  Oh well!

    Thanks for looking :)

Please Sign in or register to post replies

Write your reply to:

Draft