We have a site (actually an Application Builder) that rendered a lot of user controls in different scenarios,
One day the manager decided to add Output cache
in the main page,
OK, every things is fine and the request responded very fast!
But in the other hand this caching have some troubles:
Assume we have an InsertForm User control
that filled some entities, and a ListForm User Control
that display list of entities, So you can guess what happen, the entities filled correctly but not shown in List, why? because of output caching.
Then we must exclude this user controls from caching, after some search we find Donut Caching, and it seems very well,
We use Add dynamically server control to Substitution
Most of user controls implementations depend of all page life cycle, some of them do in Init, some in Load some of them in Render, so in most scenarios we have a place holder, what we do is:
And in PreRender remove all controls from placeHolder to prevent of duplication:
in some cases we have a good result But in some implementation again we have troubles, all of the Request
replaced with HttpContext.Current.Request
and all of the Session
s converted to fields, but in some cases like use Wizard
we still have exception: Request does not exist in this context
.
And in bind events we have troubles again, the events not bind correctly, like the wizard next button click event.
After all I fill we are in wrong way, maybe this is not practical in this scenario,
what do you think?
do we have another option?
or all of this troubles are solvable? any suggestion please?