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

[Solved] TabStrip() reload

1 Answer 246 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jose Granja
Top achievements
Rank 1
Jose Granja asked on 11 Jun 2010, 11:00 AM
Hi,

I'm using the MVC TabStrip component. I'm loading all tabs using using ajax with the function= LoadContentFrom. However I want some of the tabs to be reloaded each time (the information on tabs may change from the first request to the second).

I managed to achieve that by doing:

function onSelect(e) { 
 
            var $item = $(e.item); 
            if('BMR' == $item.find('> .t-link').text() ) 
            { 
                var $link = $item.find('.t-link'); 
                $.get('<%=Url.Action("xx", "xxxx", Model.RouteData) %>', 
                        function(data) { 
                           e.contentElement.html(data); 
                  }); 
                 
            } 

I'm looking for a cleaner and fancier way to do that. Using this approach means that for every tab that is being reloaded I have to put again the url. I looked a bit on the TabStrip and once a tab is loaded via ajax it changes the href from the url to #. There's no way to prevent the component from doing that?

I hope I explained myself well, excuse my bad english

cheers, jose




1 Answer, 1 is accepted

Sort by
0
Linas
Top achievements
Rank 1
answered on 12 Nov 2011, 07:31 PM
Hi,

you can use tabStrip.reload javasript function, here is an example:
function reloadTabPage(e) {
    if (e.contentElement.innerHTML != "") { // reload contents of tab page within Telerik TabStrip
        var tabStrip = $(e.contentElement.parentNode).data("tTabStrip");
        tabStrip.reload(e.item);
    }
}

then, all you have to do is hook to OnSelect event within your tabstrip:
.ClientEvents(events => events.OnSelect("reloadTabPage"))

and you will have a tabstrip that reloads pages on page select dynamically.
Tags
General Discussions
Asked by
Jose Granja
Top achievements
Rank 1
Answers by
Linas
Top achievements
Rank 1
Share this question
or