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

What is the syntax to open a MVC partial page inside a pannel bar

1 Answer 233 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 01 Aug 2013, 04:36 AM
Hello I would like to
know what the syntax for opening a partial page is. I would like to show a partial page as the content of an expanded bar. I also would like to pass the model as an argument when calling the partial page.

I unsuccessfully tried using the .Content like this

.Content(@<text>Html.PartialPage("_TestPartial2")</text>)

Another question I would like to add is:

in the .Content I was able use both html and Razor syntaxes. However I am not sure if I can use C# logical statements such as "if" or "while" statement.



Could you give me an example for both of them please?



Thanks.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 Aug 2013, 02:31 PM
Hello Daniel,

One option is to load PanelBar items client-side, once they are expanded:

http://demos.kendoui.com/web/panelbar/ajax.html

item.Add().Text("Root Item Text")
    .LoadContentFrom(Url.Content("~/Content/web/panelbar/ajax/ajaxContent1.html"));


Another option is to render the partial view initially via calling it server-side:

item.Add().Text("Root Item Text")
    .Content(@<text> @Html.Partial("PartialViewName") </text>);


In case you have difficulties applying general ASP.NET MVC knowledge and Razor syntax with Kendo UI MVC wrappers, I encourage you to refer to general help resources over the internet and make sure you are familiar with the required fundamental concepts in advance, e.g. learn how to work with partial views outside a Kendo UI PanelBar.


Server-side statements and expressions can be included inside PanelBar item Content() by using standard code blocks @{ ... } :

item.Add().Text("Root Item Text")
    .Content(@<text>
    some text here
    @{ if(true) { @Html.Raw("lorem ipsum") }  }
    more text
    </text>);

Note that nested <text> tags are not allowed. In case you need them, you should use custom HtmlHelpers to output content.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
PanelBar
Asked by
Daniel
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or