Copied to clipboard

Flag this post as spam?

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


  • Chris Clancy 65 posts 134 karma points
    Oct 14, 2016 @ 10:40
    Chris Clancy
    0

    Error when using Umbraco field in partial v7.5

    Hi,

    I am trying to split my templates up into partials and when I takea chunk of code out of the tempalte and instead put it into a partial, I am getting this error:

    CS0234: The type or namespace name 'Field' does not exist in the namespace 'Umbraco'

    All I have done so far is take this chunk of code out of the Master template and put it into a partial.

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>@Umbraco.Field("title")</title>
    <meta name="description" content="@Umbraco.Field("description")" />
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    

    the partial code going into the Master is:

    @Html.Partial("GlobalHeaderIncludes")
    

    Why is it not liking it?

    Error details:

    *> Compilation Error Description: An error occurred during the

    compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0234: The type or namespace name 'Field' does not exist in the namespace 'Umbraco' (are you missing an assembly reference?)

    Source Error:

    Line 1: Line 2:
    Line 3: *

    Any ideas?

    Thanks

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Oct 14, 2016 @ 11:01
    Alex Skrypnyk
    101

    Hi Chris,

    Check please that your view inherits from right namespace.

    It should be UmbracoTemplatePage or UmbracoViewPage

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    

    Thanks,

    Alex

  • Chris Clancy 65 posts 134 karma points
    Oct 14, 2016 @ 11:17
    Chris Clancy
    0

    That's great Alex. Thanks very much for the quick response.

    I knew it would be something trivial but it's been a while since I've used standard Umbraco and it's alwasy the little things that get forgotten!

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Oct 14, 2016 @ 11:18
    Alex Skrypnyk
    0

    Happy to help.

    Topic is solved, have a nice day!

    /Alex

  • 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