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

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    16 posts
    Member since:
    Feb 2013

    Posted 31 Jul 2013 Link to this post

    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.

  2. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 02 Aug 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top