Output Caching in User Control not firing postback


Ben Fidge

I've got a User Control that renders site navigation from a database. For
some reason, when using Output Caching, none of my LinkButtons fire their
PostBack events.

The declaration in the control is:

<%@ OutputCache Shared="true" VaryByParam="none" Duration="120" %>

This control is used on every page and has a significant performance hit,
but if it's not firing off any postback's is next to useless. When I remove
the above declaration it works fine.

The event handlers for the LinkButtons are all contained within the control

Am I missing something obvious?




Brock Allen

When you enable Page Fragement Caching with your user control then upon postback
the user control is not created and instead a placeholder is used instead.
This placeholder is the object that contains your cached user control. So
your events will not fire if you have cached it.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question