Programatically invalidate the OutputCache from a UserControl

vishalneeraj-24503
Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 1588
We could add a Dependency to the output cached control,and change the Dependency.
Here is the code:-

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;
}

Comments or Responses

Login to post response