Copied to clipboard

Flag this post as spam?

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


  • benjermy101 2 posts 22 karma points
    Jun 22, 2023 @ 12:42
    benjermy101
    0

    'IPublishedContent' does not contain a definition for 'Value'

    Recently i set up Umbraco 11 on a blazor project, but .Value does not work. Even tho i have created a document type and added the alias as "body".

    @inherits UmbracoViewPage;
    @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
    @using Umbraco.Cms.Web.Common.Views;
    @{
        Layout = null;
    }
    
    <p>test</p>
    @Model.Value("body")
    

    The Error i get:

    'IPublishedContent' does not contain a definition for 'Value' and the best extension method overload 'HtmlHelperValueExtensions.Value(IHtmlHelper, string)' requires a receiver of type 'IHtmlHelper'

  • Søren Kottal 702 posts 4497 karma points MVP 5x c-trib
    Jun 23, 2023 @ 09:45
    Søren Kottal
    0

    The Value method is defined in the Umbraco.Extensions namespace. Can you verify that you have @using Umbraco.Extensions in /Views/_ViewImports.cshtml?

Please Sign in or register to post replies

Write your reply to:

Draft