I have an accordion as a nested template using partial view.
I have made it an composition so I can reuse the code on other templates, which I thought worked fine...... now all of sudden it seems to have glitched and all of the accordions are the same? no matter what template/doc type I've added the composition to?
It seems that it only gets the most recent accordion doc type.
I'll try explain.
So I have a department doc type and template, I've added the accordion composition to this and everything works fine.
I have a general doc type and template, I've added the accordion composition to this and I publish and the content changes.... however it now shows the content on general template in the department template accordion? but if I then go back to my department accordion and publish that, it then goes back to how it was?
But it only seems to happen on my published site not my development?
So based on the discussion we've been having on slack, you are using Html.CachedPartial without setting a unique key per page.
This means that which ever accordion first gets cached will be used when ever that partial is called again.
Personally, unless your partial is behaviour really slowly (in which case there is probably another issue to be investigated), I wouldn't be using cached partial, instead I'd be using Html.Partial instead.
So try changing:
@Html.CachedPartial("Partials/Content/_Accordion", Model, 3600) to
@Html.Partial("Partials/Content/_Accordion", Model)
Nested content not showing correctly
Hi,
I have an accordion as a nested template using partial view.
I have made it an composition so I can reuse the code on other templates, which I thought worked fine...... now all of sudden it seems to have glitched and all of the accordions are the same? no matter what template/doc type I've added the composition to?
It seems that it only gets the most recent accordion doc type.
I'll try explain.
So I have a department doc type and template, I've added the accordion composition to this and everything works fine.
I have a general doc type and template, I've added the accordion composition to this and I publish and the content changes.... however it now shows the content on general template in the department template accordion? but if I then go back to my department accordion and publish that, it then goes back to how it was?
But it only seems to happen on my published site not my development?
Hope that makes sense......
Thanks
Hi Matt,
So based on the discussion we've been having on slack, you are using
Html.CachedPartial
without setting a unique key per page.This means that which ever accordion first gets cached will be used when ever that partial is called again.
Personally, unless your partial is behaviour really slowly (in which case there is probably another issue to be investigated), I wouldn't be using cached partial, instead I'd be using
Html.Partial
instead.So try changing:
@Html.CachedPartial("Partials/Content/_Accordion", Model, 3600)
to@Html.Partial("Partials/Content/_Accordion", Model)
See how you get on with that.
Nik
Thanks Nik, yeap I was using Html.CachedPartial
All working now :)
is working on a reply...