You could add a dependency to the output cached control, and change the dependency to evict the control. Here’s code to do that:
VB.NET
If TypeOf Parent Is System.Web.UI.BasePartialCachingControl Then
Cache('dependent') = 'dependent'
Dim dep As New CacheDependency(Nothing, New String() {'dependent'}) ’
CType(Parent, System.Web.UI.BasePartialCachingControl).Dependency = dep
End If
C#
if (Parent is System.Web.UI.BasePartialCachingControl)
{
Cache['dependent'] = 'dependent';
CacheDependency dep = new CacheDependency(null, new string[] 'dependent');
((System.Web.UI.BasePartialCachingControl)Parent).Dependency = dep;
}
Share with