Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to clear cache on an object datasource through code, through Google I figured out from asp.net that if I do the following (where the original DefaultValue for the SelectParameter = "ORIGINAL"), the cache will get cleared:

 

ObjectDataSource1.SelectParameters[0].DefaultValue = "Original";

ObjectDataSource1.SelectParameters[0].DefaultValue = "ORIGINAL";

 

This in essence marks the parameter dirty causing the ObjectDataSource control to internally call OnParameterChanged which clears the cache (thank you Reflector!). This is a hack at best to get around the problem that there is no way to directly (that I've found) to clear the cache on ObjectDataSource progamatically.

 

What's the right way to do this progamatically?

Posted

Yeah, that doesn't work. The way I came up with the hack I did was by trying to clear the Cache manually and ran into the same thing he did...there's nothing in the Cache object! Count == 0.

 

Have you gotton this to work using this method? Maybe I'm just an idiot.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...