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

[Solved] Tabstrip - Load on Demand not working for first tab

5 Answers 169 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sean Cross
Top achievements
Rank 1
Sean Cross asked on 10 Nov 2009, 03:35 AM
I have moved a project from the old Extensions to the new one.  I now have a problem with LoadOnDemand for the first tab.

My view is
        <%
            Html.Telerik().TabStrip()
                .Name("tab")
                .Items(parent => {
                    parent
                        .Add()
                        .Text("General")
                        .LoadContentFrom(Url.Action("GeneralPV", Model));
                    parent
                        .Add()                        
                        .Text("Notes")
                        .LoadContentFrom(Url.Action("NotesPV", Model));                   
                    parent
                        .Add()
                        .Text("Medical")
                        .LoadContentFrom(Url.Action("MedicalPV", Model));                                                                                       
                    }
                )
                .Render();
         %>

When I view the page, the contents of the first tab are empty.  I have to change to another tab, and then change back for the tab to populate.  Any ideas on how to fix?

Sean

5 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 10 Nov 2009, 10:02 AM
Hello Sean,

If the first tab is LoadOnDemand, the tabstrip will render collapsed. To load the content you should click the tab item. You can easily reproduce this behavior using LoadOnDemand demo of TabStrip component.

Best wishes,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sean Cross
Top achievements
Rank 1
answered on 10 Nov 2009, 07:18 PM
Is there any way to make it render uncollapsed?

Sean
0
Georgi Krustev
Telerik team
answered on 11 Nov 2009, 09:35 AM
Hello Sean,

You can achieve your goal using the client API of the control. Wire the OnDocumentReady event and expand the first item. Here is a code snippet showing how to achieve this:
<% Html.Telerik().ScriptRegistrar().OnDocumentReady(() =>
{
    %>
        var panelBar = $("#PanelBar").data("tPanelBar");
        panelBar.expand($("> li", panelBar.element)[0]);
    <%
    });
%>

I have attached a test project which shows how the suggested approach was implemented.

Sincerely yours,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sean Cross
Top achievements
Rank 1
answered on 15 Nov 2009, 09:43 PM
That works for PanelBars but I can't get it to work for a tab strip.
0
Accepted
Georgi Krustev
Telerik team
answered on 16 Nov 2009, 10:27 AM
Hello Sean,

The suggested method will not work, because the jQuery selector does not return the correct LI element. Please use this one:
var tabStrip = $("#TabStrip").data("tTabStrip");
tabStrip.select($("li", tabStrip.element)[0]);

All the best,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TabStrip
Asked by
Sean Cross
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Sean Cross
Top achievements
Rank 1
Share this question
or