Grid in TabStrip not working

3 posts, 1 answers
  1. Patrik Johansson
    Patrik Johansson avatar
    270 posts
    Member since:
    May 2010

    Posted 06 Nov 2015 Link to this post

    First, it would be really helpful with a good example of using Grids in a TabStrip, I am sure many more than I want to do that.

     

    I have a TabStrip with 2 tabs each containing one grid. When I load up the View containing the TabStrip it seems like both Grids tries to load its data, but only one of them (on the first/active tab) actually manage to display some data. Here is my TabStrip:

     

    <div id="forecast">
        @(Html.Kendo().TabStrip()
              .Name("BackOfficeTabStrip")
              .Items(tabstrip =>
              {
                  tabstrip.Add().Text("Bostadstyper")
                      .Selected(true)
                      .Content(@<text> @Html.Action("Index", "AccommodationType")</text>);


                  tabstrip.Add().Text("Civilstatus")
                      .Selected(false)
                      .Content(@<text> @Html.Action("Index", "CivilStatusType")</text>);
              })
              )
    </div>​

     

    And my "subviews" are setup as MVC partials and work fine on their own.

     

    Are Partials the preferred way of handling "subviews" in a TabStrip? What are the settings available to control loading of contents?

  2. Answer
    Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 10 Nov 2015 Link to this post

    Hello Patrik,

    Based on the provided information, my best guess is that the Grid Names in the two partial views are identical. This causes duplicate IDs to be present on the web page, and as a result, the second Grid is not initialized, because its DOM element becomes inaccessible to the JavaScript code.

    Let me know if your scenario is different.

    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
  4. Patrik Johansson
    Patrik Johansson avatar
    270 posts
    Member since:
    May 2010

    Posted 10 Nov 2015 in reply to Dimo Link to this post

    It hurts to admit this but you were....right :)

     

    I thought that as they originate from different partials it would work anyway but apparently it didn't. Thanks for solving this.

Back to Top