This is a migrated thread and some comments may be shown as answers.
How do I prevent tabstrip from caching my content?
3 Answers 7 Views
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 07 Feb 2020, 06:36 PM

I am using the tabstrip to create a step-wise type form where each tab has a different model and partial view.

The content of a tab is based on what was entered on a previous tab.

I am using LoadContentFrom to call a controller action to return the partial view and model.

This is working fine.

Problem Scenario:

If the user enters/saves data in tab 2, goes to tab 3 and enters/saves data and then goes back to tab 2 I have a controller action that removes the data saved in tab 3.

When they finish updating data in tab 2 and go to tab 3 the next time I don't want that stale content, I need to be able to call the controller action to return a new partial with a model.

Isn't there a way to say that a tab SHOULD NOT cache the content?

I want fresh content every time they go to the tab...and, of course, any events related to that new partial need to work.

3 Answers, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 11 Feb 2020, 09:45 AM

Hi Bill,

What you can do is to use the reload method of the TabStrip for the tab/s which content you don't want to be saved. 

If we talk in the context of the scenario you've described, you can run the following code when the "Submit" button of tab 2 is pressed.

tabStrip.reload("li:eq(2)");

Where tabstrip is a reference to the Tabstrip component used and "2" in the "li:eq(2)" selector points to the third tab.

Here is a Dojo that demonstrates the usage of the above line. If you open the browser's Network tab and press the "Reload Tab 2" button, a new network request will be sent. 

Try applying the suggested approach and let me know if it resolves the issue in the application you are working on.

Regards,
Petar
Progress Telerik

Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
0
Bill
Top achievements
Rank 1
answered on 27 Feb 2020, 04:51 PM
While there are no javascript errors, it is not clearing the content.
0
Petar
Telerik team
answered on 02 Mar 2020, 01:16 PM

Hi Bill,

Attached to my reply you will find an archive that demonstrates that once the "Reload Tab2" button is pressed, the content in Tab 2 is refreshed. To test the project, start the attached files using a web server and navigate to tab 2. Enter data for the "First name" and "Last name" fields. Go to tab 1 or tab 3 and then navigate back to tab 2. The entered data for the first and last names will still be available. Navigate to tab 1 and press the "Reload Tab2" button. Go to the second tab and see that the entered in the inputs data is missing. 

Regarding your last reply, I can only guess what are the errors you get and why are you getting them without having the implementation you are working on. To be able to help you, I will need a runnable example in which the functionality you are trying to implement can be tested. If you don't want to share your code publicly, you can submit a support ticket with the mentioned above example and details about the targeted functionality. 

Regards,
Petar
Progress Telerik

Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
Asked by
Bill
Top achievements
Rank 1
Answers by
Petar
Telerik team
Bill
Top achievements
Rank 1
Share this question
or