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

[Solved] [VB.NET/Tabscript/IE] Problem in IE - Caching

1 Answer 83 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.
Michiel Peeters
Top achievements
Rank 1
Michiel Peeters asked on 11 May 2010, 10:10 AM
Dear Telerik Community,

I have created a thread on the general forum with a question about caching. In that thread i was saying that the tabcontrol gets the latest content when you use the loadcontentfrom, but after some further investigation i have discovered (maybe) a bug or something familiar. In Internet Explorer (iE8) when i add new (dynamic) content to my tabcontent it does not get updated, in other modern browsers it does get updated (do not ask me why because i really can not discover why they update and IE not). I have added the following code snippet what i have found on the forum:

<script type="text/javascript">  
    function onSelect(e) {  
        var $item = $(e.item);  
        var $link = $item.find('.t-link');  
        var contentUrl = $link.data('ContentUrl');  
        if (contentUrl) {  
            $.get(contentUrl,  
                function(data) {  
                    e.contentElement.html(data);  
                });  
        }  
    }  
</script> 

and have added this to the tabcontrol:

<%    
    Dim tabBuilder As Telerik.Web.Mvc.UI.TabStripBuilder = Html.Telerik().TabStrip()  
      
    tabBuilder.Name("TabProjectDetails")  
    tabBuilder.ClientEvents(Function(clientEvent) clientEvent.OnSelect("onSelect"))  
     
    For Each projectTypeEntity In Model.ProjectTypes  
        Dim strName As String = projectTypeEntity.Name  
        Dim intId As Integer = projectTypeEntity.Id  
        tabBuilder.Items(Function(tab) tab.Add().Text(strName).LoadContentFrom("Load" & strName & "Versions""ProjectType"New With {.id = intId}))  
    Next 
      
    tabBuilder.SelectedIndex(ViewData("viewTemplate"))  
    tabBuilder.Render()  
%> 

And IE just caches all the time everything. Even when i click on a tab it does not refresh its own contents. Even when i debug on the controller my controller does not get fired (in other modern browsers it does). My question is how can i try to solve this issue.

Kind regards,
Michiel Peeters


1 Answer, 1 is accepted

Sort by
0
Michiel Peeters
Top achievements
Rank 1
answered on 12 May 2010, 03:11 PM
It seems to be that the problem is that IE caching mechanism is shit. The following codeblock works but it needed an extra parameter so that the caching mechanism of IE is forced to refresh its contents.

<script type="text/javascript">  
    function onSelect(e) {  
        var $item = $(e.item);  
        var $link = $item.find('.t-link');  
        var contentUrl = $link.data('ContentUrl') + '?a=' + Math.floor(Math.random() * 11);  
        if (contentUrl) {  
            $.get(contentUrl, function(data) {  
                e.contentElement.html(data);  
            });  
        }  
    }  
</script> 

Yours faithfully,
Michiel Peeters

So to be short my problem is solved.
Tags
TabStrip
Asked by
Michiel Peeters
Top achievements
Rank 1
Answers by
Michiel Peeters
Top achievements
Rank 1
Share this question
or