Copied to clipboard

Flag this post as spam?

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


  • mikkel 143 posts 365 karma points
    Mar 31, 2019 @ 13:37
    mikkel
    0

    How do i use modelsbuilder i umbraco 8

    When i use models builder in umbraco 7 i am used to use

    var = Model.Content.Children<test>();
    

    But that dont work in umbraco 8 what do i use insteadt ?

  • Bjarne Fyrstenborg 1286 posts 4060 karma points MVP 8x c-trib
    Mar 31, 2019 @ 18:41
    Bjarne Fyrstenborg
    1

    Hi Mikkel

    In Umbraco v8 the RenderModel has been removed, so instead of Model.Content it is just Model.

    So in your case it would be:

    var items = Model.Children<Test>();
    

    or

    var items = Model.ChildrenOfType("test");
    

    or

    var items = Model.ChildrenOfType(Test.ModelTypeAlias);
    

    /Bjarne

  • mikkel 143 posts 365 karma points
    Apr 03, 2019 @ 17:08
    mikkel
    0

    hi Bjarne it makes sense. I'll try it tomorrow. thanks for your help

  • mikkel 143 posts 365 karma points
    Apr 05, 2019 @ 10:56
    mikkel
    0

    Bjarne. Do you have a link to where i can read about it ?

  • 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