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

Select tab based on value in model

2 Answers 169 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 09 Dec 2019, 02:47 AM

I'm trying to select which tab is active when the screen is loaded Here's the code I'm using but it doesn't work. Neither tab is selected when the tab strip is loaded.

<div class="col-sm-offset-3 col-md-offset-3">
    @(Html.Kendo().TabStrip()
    .Name("tabstrip")
    .TabPosition(TabStripTabPosition.Top)
    .Collapsible(true)
    .Navigatable(false)
    .Animation(animation =>
    {
        animation.Open(config =>
        {
            config.Fade(FadeDirection.In);
        });
    })
    .Items(items =>
    {
        items.Add().Text("Contact").LoadContentFrom("EditContact", "People", new { id = Model.person.Id }).Selected("@Model.tab" == "Contact");
        items.Add().Text("Address").LoadContentFrom("EditAddress", "People", new { id = Model.person.Id }).Selected("@Model.tab" == "Address");
    })
    .Events(e => e.Activate("onActivate"))
    )
</div>

2 Answers, 1 is accepted

Sort by
0
Accepted
Petar
Telerik team
answered on 11 Dec 2019, 12:50 PM

Hi Tom,

I've used your code to prepare a simple example(attached to my reply).

The provided code is working properly on my end. Can you check the attached project and compare it to the definition in the application you are working on? If the issue continues to exist on your end, modify the attached application in a way the reported behavior can be reproduced and send it back to me, so I can further investigate what is the reason for the reported behavior.

Looking forward to your reply.

Regards,
Petar
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
0
Tom
Top achievements
Rank 1
answered on 12 Dec 2019, 01:16 AM
Yes, your code does what I want. Thank you for your help.
Tags
TabStrip
Asked by
Tom
Top achievements
Rank 1
Answers by
Petar
Telerik team
Tom
Top achievements
Rank 1
Share this question
or