Copied to clipboard

Flag this post as spam?

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


  • Gordon Smith 21 posts 103 karma points
    Feb 09, 2023 @ 15:17
    Gordon Smith
    0

    'IHtmlHelper<dynamic>' does not contain a definition for 'GetGridHtml'

    Upgrading to v11

    I have to upgrade a raft of websites from Umbraco 8 to v11. I am having problems with the Grid Editor and templates. I am using the documentation at: https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/grid-layout/render-grid-in-template

    In a clean install, when I try to manually recreate the templates, which reference Grids in many document types, I cannot find Grid Editor in the "Select Editor" list. Where should I be looking?

    And, in an import of content using Usync into a clean install of Umbraco 11, where the templates have been copied in, I hit the following error:

    "'IHtmlHelper

    On this line:

    @Html.GetGridHtml(Model, "bodyText", "bootstrap3-fluid")

    But it seems that @Html.GetGridHtml somehow does not exist in this installation.

    Have I installed Umbraco incorrectly?

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Feb 09, 2023 @ 16:06
    Huw Reddick
    0

    The Grid Editor has been marked as obsolete in v11. There is a setting you can enable in the appsettings.json file to re-enable obsolete property editors to allow the grid to be seen

    https://docs.umbraco.com/umbraco-cms/reference/configuration/contentsettings#show-deprecated-property-editors

  • Gordon Smith 21 posts 103 karma points
    Feb 12, 2023 @ 09:30
    Gordon Smith
    0

    Thanks Huw.

    Changing that setting does indeed allow the Grid Editor to be seen and edited in the backoffice.

    But it does not remove the error:

    IHtmlHelper<dynamic>' does not contain a definition for 'GetGridHtml' and no accessible extension method 'GetGridHtml' accepting a first argument of type 'IHtmlHelper<dynamic>' could be found (are you missing a using directive or an assembly reference?)
    

    How would we resolve this error and continue the upgrade?

    Alternatively how do we migrate our hundreds of pages using the Grid Editor to the Block Editor? 😣

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Feb 12, 2023 @ 12:58
    Huw Reddick
    0

    Are you certain you have all the right usings etc?

    I don't see that if I add @Html.GetGridHtml(Model, "bodyText", "bootstrap3-fluid") to a view template

  • Gordon Smith 21 posts 103 karma points
    Feb 13, 2023 @ 08:04
    Gordon Smith
    1

    Thanks Huw!

    I'm not sure whether I am using the usings I should be using. 🙂

    The documentation I'm following is at https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/grid-layout/render-grid-in-template but it doesn't say on that page which usings to use.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Feb 13, 2023 @ 08:38
    Huw Reddick
    0

    Hi Gordon,

    WHich version of Umbraco are you using and I will take a quick look.

  • Gordon Smith 21 posts 103 karma points
    Feb 13, 2023 @ 08:45
    Gordon Smith
    0

    11.0.0

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Feb 14, 2023 @ 08:20
    Huw Reddick
    0

    Hi Gordon,

    I'm afraid I have no idea what is causing your issue. I just created a new clean 11.0.0 project, enabled the grid editor and created a basic template with some content in the grid and everything works as expected.

    This is the page template

    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
    @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
    @{
        Layout = null;
    }
    
    @Html.GetGridHtml(Model, "bodyText", "bootstrap3-fluid")
    
  • Gordon Smith 21 posts 103 karma points
    Feb 14, 2023 @ 09:35
    Gordon Smith
    0

    Ah well.

    I have tried using exactly your code, but still get the error.

    I have gone back to Umbraco 10 as I don't have time for this kind of thing.

    Thank you for your help Huw, very kind.

  • mc2 13 posts 74 karma points
    Jun 22, 2023 @ 09:20
    mc2
    0

    Hi, I just had the same issue but with

    Html.GetBlockGridItemAreaHtmlAsync
    

    The issue was that my custom views folder did not have "_ViewImports.cshtml" file, copying the one that is in by default in "/Views" folder fixed the issue.

Please Sign in or register to post replies

Write your reply to:

Draft