Loading partial view on menu item click

4 posts, 1 answers
  1. Shabtai
    Shabtai avatar
    38 posts
    Member since:
    Nov 2012

    Posted 19 Dec 2012 Link to this post

    Hello, 
    I'm using Kendo Menu

    <script>
    function onSelected(e) { }
    </script>
            <div class="k-rtl" >
                <%= Html.Kendo().Menu()
                    .Name("Menu").Events(ev=>ev.Select("onSelected"))
                    .Items(items =>
                    {
                        items.Add()
                             .Text("menu1")
                             .Items(children =>
                             {
                                 children.Add().Text("Sub Item 1");
                                 children.Add().Text("Sub Item 2");
                                 children.Add().Text("Sub Item 3");
                                 children.Add().Text("Sub Item 4");
                                 children.Add().Text("Sub Item 5");
                             });

                        items.Add()
                            .Text("menu2")
                            .Items(children =>
                            {
                                children.Add().Text("Sub Item 1");
                                children.Add().Text("Sub Item 2");
                                children.Add().Text("Sub Item 3");
                                children.Add().Text("Sub Item 4");
                                children.Add().Text("Sub Item 5");
                            });

                    })
                %>
            </div>
            <div id="contentFrame">
                     <%--<% Html.RenderPartial("~/Views/Ascx/WizardControl.ascx"); %>--%>
            </div>

    The view is under master page
    I need to load partial view (ascx) dynamically into the div (contentFrame) depending on the selected menu item.

    How can I perform this?

    Thank you in advance
    Shabby
  2. Answer
    Holger
    Holger avatar
    78 posts
    Member since:
    Nov 2012

    Posted 20 Dec 2012 Link to this post

    Hi,

    I have created a small demo project that shows how to load partial views via menu.

    Hope this helps,
    Holger
  3. Shabtai
    Shabtai avatar
    38 posts
    Member since:
    Nov 2012

    Posted 20 Dec 2012 Link to this post

    Thank you very much!

    Do you have server-side solution when creating menu in razor as well? (Against JS solution)
  4. Holger
    Holger avatar
    78 posts
    Member since:
    Nov 2012

    Posted 20 Dec 2012 Link to this post

    >Do you have server-side solution when creating menu in razor as well? (Against JS solution)
    Unfortunately not, we are not using server side MVC wrappers.

    After a year of using server side MVC extensions (from another vendor) we decided to change to a full client side (JavaScript) library.
Back to Top