Copied to clipboard

Flag this post as spam?

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


  • Anders Brohus 194 posts 475 karma points
    Jul 07, 2015 @ 12:01
    Anders Brohus
    0

    Extending the Umbraco Grid

    Hi! :)

    Currently i'm developing where i'm using the Umbraco Grid, and i'm using a custom grid render. But i have run into a problem, because i would like the grid to render an "wrap" div if the editor used in the grid isn't an specific type.. :)

    I'm using this code

    <div class="[email protected] [email protected] column">
                            <div @RenderElementAttributes(area)>
                                @foreach (var control in area.controls)
                                {
                                    if (control != null && control.editor != null && control.editor.view != null)
                                    {
                                        <text>@Html.Partial("grid/editors/base", (object)control)</text>
                                    }
                                }
                            </div>
                    </div>
    

    It's working but i need that wrap div on all it renders except for an editor called "referanceBlock".

    I tried and i could see in the JSON that it sees the alias on the editor it renders, i just can't get it to work :/

    I would like to have a result like this

    <div class="[email protected] [email protected] column">
                            <div class="content"> //ONLY if it's NOT referanceBlock
                                <div @RenderElementAttributes(area)>
                                    @foreach (var control in area.controls)
                                    {
                                        if (control != null && control.editor != null && control.editor.view != null)
                                        {
                                            <text>@Html.Partial("grid/editors/base", (object)control)</text>
                                        }
                                    }
                                </div>
                            </div> // ONLY if it's NOT referanceBlock
                        </div>
    

    Can you guys help me?

Please Sign in or register to post replies

Write your reply to:

Draft