This is a migrated thread and some comments may be shown as answers.

Mobile view doesn't render body

1 Answer 119 Views
View
This is a migrated thread and some comments may be shown as answers.
Dekel
Top achievements
Rank 1
Dekel asked on 28 Jun 2015, 09:06 PM

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.

1 Answer, 1 is accepted

Sort by
0
Dekel
Top achievements
Rank 1
answered on 28 Jun 2015, 09:46 PM

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.

Tags
View
Asked by
Dekel
Top achievements
Rank 1
Answers by
Dekel
Top achievements
Rank 1
Share this question
or