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

[Solved] PanelBar OutputCache issue

5 Answers 141 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Philip Fourie
Top achievements
Rank 1
Philip Fourie asked on 07 Feb 2012, 06:55 AM
I am having difficulty to cache the PanelBar using the `OutputCache` attribute.
The control works the first time it is rendered but after being cached clicking on the PanelBar does not have any effect (it does not perform the open/close animations).

It is used as follows:

Controller
[OutputCache(Duration = 60*5)]
public PartialViewResult NavigationMenu()
{
    return PartialView();
}

View
@Html.Action("NavigationMenu", "Home")

_Layout.cshtml
@(Html.Telerik().ScriptRegistrar()
                 .DefaultGroup(group => group
                 .Add("telerik.common.js")
                 .Add("telerik.panelbar.js")
                 .Compress(false)))

Looking at FireBug's output it does not provide and JavaScript or download errors.
I must be missing a basic step but cannot work it out.

I am using 2011.3.1115 (Update: 2012.2.214 also behaves the same)

Update:
Running diff between the working and non-working HTML showed that the following generated scripts is missing:
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
jQuery('#NavigationMenu').tPanelBar({effects:{list:[{name:'property',properties:['height','opacity']}],openDuration:200,closeDuration:300}, expandMode:1});});
//]]>
</script>

How do I get it to generate the required JavaScript?

Thank you,
Philip

5 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 06 Aug 2012, 06:58 PM
Philip,
Did you ever get an answer to this or get it figured out? I am having a similar issue with the exception that the script output is never being generated in my case.

Thank you

Mike Wasmer
0
Philip Fourie
Top achievements
Rank 1
answered on 09 Aug 2012, 11:15 AM
Hi Mike,

Unfortunately I have not found an answer.   Please post here if you manage to find a solution.
I would really like to cache this control as it is the slowest part to render on my web pages :(

Kind regards,
Philip
0
jian
Top achievements
Rank 1
answered on 06 Oct 2012, 05:43 AM
I recently fall in a bug of caching a MVC treeview in a partial view. The treeview works fine for the first time the page loads, but subsequent requests fails.

After taking a quick view of the source code, I think it may an architectural problem in Telerik MVC extensions. The treeview register jquery block to ScriptRegistrar, and the scriptRegistrar collects script block of the page and renders them in a central place. As the treeview (or the PanelBar in your case) is cached, the Render() function of these controls is not called, and so no script is registered to the ScriptRegistrar ......

I wish I am wrong .....
0
Philip Fourie
Top achievements
Rank 1
answered on 28 Oct 2012, 12:34 PM
Hi Jian,

Have had any luck resolving this issue?   Unfortunately I have not yet found a solution.

Kind regards,
Philip
0
jian
Top achievements
Rank 1
answered on 28 Oct 2012, 12:56 PM
Unfortunately, I found no simply solution :-(

In your case, may be you can choose one of the following:

1) cache the data that is used for rendering the Panel instead of caching the partial view
2) define a method such as JsonNavigationMenu() that returns the json data for the panel, so you can use OutputCache.
3) Use ajax to get the partial view

I guess (1) is the easiest way with minimum effort.

Tags
PanelBar
Asked by
Philip Fourie
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Philip Fourie
Top achievements
Rank 1
jian
Top achievements
Rank 1
Share this question
or