Mobile view doesn't render body

2 posts, 0 answers
  1. Dekel
    Dekel avatar
    25 posts
    Member since:
    Jan 2015

    Posted 28 Jun 2015 Link to this post

    I use Kendo MVC mobile view in my layout view.

    When I try to render body in the content function nothing is happening.

    I expect that it would just render all views / partial views that I have in any of the page that are rendered in RenderBody().

    Kendo MVC MobileView declaration:

    @(Html.Kendo().MobileView()
           .Name("drawer-home")
           .Layout("drawer-layout")
           .Content(@<text>
                        <div class="content">
                            @RenderBody()
                        </div>
                        @Html.Action("Footer", "Layout")
                    </text>)
    )

    RenderBody() data example:

    <div class="mainWarrper">
        @if (Model != null)
        {
            if (Model.CarouselViewModel != null)
            {
                Html.Partial("_CarouselView", @Model.CarouselViewModel);
            }

            if (Model.OnPageMenu.Any())
            {
                Html.Partial("_Menu", @Model.Menu);
            }

            if (Model.Category != null)
            {
                Html.Partial("_Category", @Model.Category);
            }
        }
    </div>

    When I debug this code everything every thing seems to run and execute as it should, but still nothing is rendered to my website and I'm getting an empty "mainWarrper" div while the @Html.Action("Footer", "Layout") rendered as it should.

     

    Thank you.

  2. Dekel
    Dekel avatar
    25 posts
    Member since:
    Jan 2015

    Posted 28 Jun 2015 in reply to Dekel Link to this post

    Problem solved.

    Since I use content function with <text></text> to render body, I need to use razor engine in each helper.

    I can't based on surrounding it like I did with my condition:

    @if (Model != null)
    {

    }

     Thank you.

  3. Kendo UI is VS 2017 Ready
Back to Top