Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm using CachedPartial html helper which caches that partial view.
@Html.CachedPartial("PartialView", MyModel, 3600, true);
In my view, I have the following situation:
@Html.CachedPartial("PartialView", MyModel, 3600, true); @Html.CachedPartial("AnotherPartialView", MyModel1, 3600, true); @Html.CachedPartial("PartialView", MyModel3, 3600, true); // I want to reuse partial view
Seems that first and third view are identically because of CachedPartial ...
CachedPartial
How to make cached partial by model parameter ?
I tried to use
@Html.CachedPartial("PartialView", MyModel, 3600, true, false, new ViewDataDictionary(MyModel3));
but same thing.
You could try using the contextual key builder to create a unique key based on your model. Something like:
@Html.CachedPartial("PartialView", MyModel, 3600, true, contextualKeyBuilder: (model, viewData) => MyModel.UniqueKey)
You'd have to have a property on your model that returns a unique value (eg. UniqueKey) for the model instance (or maybe override ToString() for this).
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Cache partial view using Umbraco CachedPartial for different model
I'm using CachedPartial html helper which caches that partial view.
In my view, I have the following situation:
Seems that first and third view are identically because of
CachedPartial
...How to make cached partial by model parameter ?
I tried to use
but same thing.
You could try using the contextual key builder to create a unique key based on your model. Something like:
You'd have to have a property on your model that returns a unique value (eg. UniqueKey) for the model instance (or maybe override ToString() for this).
is working on a reply...