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

Grid in TabStrip not working

3 Answers 341 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
improwise
Top achievements
Rank 1
Iron
Iron
improwise asked on 06 Nov 2015, 10:37 PM

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?

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 10 Nov 2015, 04:14 PM
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!
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 10 Nov 2015, 04:26 PM

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.

0
Amber
Top achievements
Rank 1
answered on 28 May 2019, 07:13 PM
This worked for me as well. I had dynamic tabs which all used the same partial view but with different parameter value.
Tags
TabStrip
Asked by
improwise
Top achievements
Rank 1
Iron
Iron
Answers by
Dimo
Telerik team
improwise
Top achievements
Rank 1
Iron
Iron
Amber
Top achievements
Rank 1
Share this question
or