Copied to clipboard

Flag this post as spam?

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


  • Lasse 49 posts 161 karma points
    Apr 30, 2019 @ 06:37
    Lasse
    0

    Grid Layout container class

    Hello,

    I can't seem to find when the class="container" is auto generated with my grid layout, as my page size is a bit too small to contain the content that i want.

    enter image description here

    As seen on the picture, the highlighted line is the class that i want to add a custom css for, to control the width of my content.

    any ideas where it would be located?

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Apr 30, 2019 @ 07:19
    Dave Woestenborghs
    0

    Hi Lasse,

    You can find the rendering of the grid layout in this folder of your website : / /Views/Partials/Grid

    You will see several razor views there. By default the grid uses Bootstrap3.cshtml

    Looking at the code it seems this get added when a row has more than one column.

    You can change this view. But to be safe with upgrades I would create my own view.

    And when you created your own view you can use it for rendering the grid by passing the name to the method you are using to render the grid : https://our.umbraco.com/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Grid-Layout/Render-Grid-In-Template#using-htmlgetgridhtml

    Dave

  • Lasse 49 posts 161 karma points
    Apr 30, 2019 @ 07:26
    Lasse
    0

    Hey dave,

    I found the file and verified it.

    I have a follow up question if you got time

    enter image description here

    Is it possible to make it change class to something else, if a specific template type is used?

    like if a page is of a specific template type e.g. could be protected like a login screen. then it changes the class for those pages

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Apr 30, 2019 @ 07:57
    Dave Woestenborghs
    100

    Hi Lasse,

    In that view you have access to the current page through Umbraco.AssignedContentItem

    So you can get the documenttype alias like this

    Umbraco.AssignedContentItem.DocumentTypeAlias
    

    Or the template alias like this

    Umbraco.AssignedContentItem.GetTemplateAlias()
    

    Dave

  • Lasse 49 posts 161 karma points
    Apr 30, 2019 @ 08:26
    Lasse
    0

    Hi dave,

    thanks for your time, it works perfectly

Please Sign in or register to post replies

Write your reply to:

Draft