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

MVC TabStrip - How to change text of the tab item when a select event occurs on a tab.

5 Answers 301 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Arul
Top achievements
Rank 1
Arul asked on 03 Nov 2014, 04:03 AM
(1) I am using MVC application with Kendo MVC wrapper with razor syntax.
     I am trying to change a text of a tab item when a tab item is selected. How do i do that?

For example, disabling another tab-item when a tab is selected is NOT working with the current code.

==============================================================
event handler code (NOT working as far as disabling the tab item):

<script>
   function tabMain_select(e) {
        // gives valid item here - i checked in the debugger.
        var tabstripD = $("#tabMain").kendoTabStrip().data();      
        $(tabstripD).disable(0);
</script>

===========================================================
Code that renders the tab with three tab items (this works):
@(Html.Kendo()
    .TabStrip()
    .Name("tabMain")
    .Animation(false)
    .Events(e=>e.Select("tabMain_select"))
    .Items(tabs => 
                {
                    tabs.Add().Text("Recent History")
                              .Selected(true)                               // Will render as this tab selected
                              .LoadContentFrom("About","home");             // to render a view into this tab. 
                      
                    tabs.Add()
                        .Text("Package")
                        .LoadContentFrom("About","home")
                        .HtmlAttributes(new { style = "margin-right:60px" }); // To give space after this tab but before the next tab item.

                    tabs.Add()
                        .Text("Dirty Returns")
                        .LoadContentFrom("About", "home");
                }
            )
  )
=========================================================

5 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 04 Nov 2014, 09:46 AM
Hi Arul,


Here is a sample approach to change the text of the currently selected tab in the select event, by using the provided e.item parameter.
E.g.
function select(e) {
    $(e.item).find("a").text("new text");
}

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Arul
Top achievements
Rank 1
answered on 04 Nov 2014, 04:18 PM
How cool! Thank You! I will try that.
0
Arul
Top achievements
Rank 1
answered on 04 Nov 2014, 04:18 PM
Thank you! I will try that.
0
Arul
Top achievements
Rank 1
answered on 04 Nov 2014, 04:20 PM
Thank You! I appreciate your help. I will try this.
-Arul.
0
Dimiter Madjarov
Telerik team
answered on 05 Nov 2014, 10:00 AM
Hello Arul,


Thanks for the update. I am glad the issue is resolved.

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TabStrip
Asked by
Arul
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Arul
Top achievements
Rank 1
Share this question
or