Load the contents of the tab only when a tab is clicked

2 posts, 0 answers
  1. RJ
    RJ avatar
    4 posts
    Member since:
    Mar 2016

    Posted 04 Apr Link to this post

    Hi,

    I am using tabstrip to load content from different partial views. I am doing it as below:

     

    @(Html.Kendo().TabStrip()
        .Name("tabstrip")
        .Items(tabstrip =>
        {
            tabstrip.Add().Text("Tab1");
            tabstrip.Add().Text("Tab2");
        })
        .ItemAction(item=>
        {
            if(.....)
            {
                item.Selected = true;
                item.Html = Html.Partial("Tab1").ToString();
            }
            else if(....)
            {
                item.Selected = true;
                item.Html = Html.Partial("Tab2").ToString();
            }
        })
        )

     

    When I do it without specifying if/else's, I am having issues loading the partial views. Each partial view is having kendo editor and in the editor we have some content and url's. Without using if/else, when I load the tabs by rendering the partials, the partial that is rendered first is loaded without issues. But the partial that is rendered after loading the first partial, does not load the 2nd partial correctly. It has issues like, url's are not clickable inside of the editor and even the editor is behaving unexpectedly.

    Going through the threads in this forum, gave me the idea of using if/else and I thought that might be helpful. But, I am not sure how to specify the condition in there to know which tab is clicked.

     

    I tried using condition like if(item.Text.Equals("Tab1"), but this is of no use. I am getting same error again.

    Please help!

     

    Thanks.

     

     

  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 06 Apr Link to this post

    Hi Romica,

    Based on the provided information, it sounds like there are duplicate IDs in the various partial views that the TabStrip renders. This violates web standards and cannot be supported. Please use unique IDs in all partial views that may be rendered on the page. The same requirement exists also if a Kendo UI TabStrip is not used.

    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