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

Client-side rendering of Partial Views

1 Answer 195 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
IT Dept
Top achievements
Rank 1
IT Dept asked on 30 Mar 2017, 03:02 PM

Hello everyone, I need to fill panel bar content with partial views. My current code is

 

@(Html.Kendo().PanelBar()
        .Name("reportFilters")
        .ExpandMode(PanelBarExpandMode.Multiple)
        .ExpandAll(true)
        .Animation(true)
        .Items(panelbar =>
        {
            foreach (IFilterCategory filterCateg in Model)
            {
                panelbar.Add()
                 .Text(filterCateg.DisplayName)
            .Content(@<text><div style="padding-top:5px;padding-left:5px;padding-right:5px">
@Html.Action(filterCateg.Action, filterCateg.Controller, new { filterCateg = filterCateg })</div></text>);
            }
        }
    )
)

 

and after reading the following post 

http://www.telerik.com/forums/what-is-the-syntax-to-open-a-mvc-partial-page-inside-a-pannel-bar#hmqmhkbB-kyThT8J06ygng

i tried to achieve client side rendering by using LoadContentFrom and .Action() without success. The best try was hitting the controller but the object filterCateg is null.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 03 Apr 2017, 11:42 AM
Hello,

Indeed, the referenced post covers the possible scenarios to load content in the Items of the panelBar. In addition, your current implementation also seems correct. I am afraid, however, that we cannot be sure why the filterCateg is empty when you attempt to create items base on each one of them. Please make sure that the model is correctly filled and passed to the view, where you aim to use them. 

You can event test the correct passing of the model in a separate section, not within the itself. In addition, you can try using the BindTo method, as demonstrated in the following forum thread:

http://www.telerik.com/forums/dynamically-creating-panel-bar-items-containing-partial-views-and-models#9ALNw6_6Gk-A3s8LfDOyUA

Regards,
Nencho
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
PanelBar
Asked by
IT Dept
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or