Web Forms :: User Control Not Caching
Mar 3, 2010
I have a user control (.ascx file). I simply put this tag in the page declarations section:
<%@ OutputCache Duration="60" VaryByParam="none" %>
It is not caching. The control makes a call to SQL and displays some information. I tested it by changing a value in the database and refreshing the page. The control keeps making a call to the database eventhough I have the duraction set to 60 seconds. Am I missing something? Do I need to add code in the Page Load event?
View 1 Replies
Similar Messages:
Jun 14, 2010
I have a page with a number of user controls, In one of my user controls I have a button event. I turn on output cache for the user control that has the button and vary by control using the ID property of a hidden field control in the user control. whenever I turn on the output cache my button event doesn't fire.
View 2 Replies
Jan 11, 2010
I have a user control (say PricingGrid.ascx) which generates a pricing grid on a given product's page. I pass the user control 2 parameters : currencyId and productId. The user control has output caching specified by
[Code]....
I am adding PricingGrid.ascx to my page programatically, i.e. using LoadControl [URL]If the user changes their currency and refreshes the page, the cached version of their original currency is still showing, until the 60 seconds expires. Is there any way to force the page to check :1) Does a cached version of PricingGrid.ascx with their new currency exist?2) If so, retrieve that version, and if not, create that version.If I output all the keys in the Page.Cache object on PageLoad, I'm not seeing my user control in the output.
View 3 Replies
Sep 25, 2010
I have aspx page with a user control. I want to implement caching for the entire page except the user control.
View 2 Replies
Mar 4, 2011
I have a page which contains a user control. The structure of the page is as shown below:
Incase your not able to see the above image, check it at [URL] Now, apart from the contents of the UserControl, I'd like to cache the entire page. I tried using the OutputCache attribute in the .aspx page, however it caches the contents of the UserControl as well.
View 4 Replies
Sep 8, 2010
My asp.net app is heavily using user controls and is high load; my concern is that loading user controls for every request (Page.LoadControl(controlPath)) is sub-optimal at best. I was thinking of caching an instance of loaded user control in HttpRuntime, but I don't know how's it going to behave when multiple connections (threads) will try to fetch it from the cache and modify properties - I guess trouble is waiting there. Any good way to optimize user control loading?
Again, I am talking about caching user control, not it's html output (which it makes no sense caching as it's [html output] going to be different every time you use it)
View 1 Replies
Jul 23, 2010
I have a page with the following caching defined:
<%@ OutputCache Duration="60" VaryByParam="None" %>
I have a user control inside that page that i don't want cached. How can I turn it off just for that control?
View 1 Replies
Jul 13, 2010
I'm trying to cache user controls and on some pages i want to cache single objects. There are multiple ways of implementing caching, and my head is breaking over it.
The way I see the caching options now:
You have the PartialCaching option which is set to cache the control for 30 minutes, and after that it clears itself... You have the varyByParam to identity the page by its querystring paramaters... or other vary options
But i just cant find an appropriate way to add caching to a control, and be able to clear the caching programmatically when i update one of the objects used in the control from the backend.
You can do HttpContext.Current.Cache.Insert(), which accepts a key on which you can destroy the caching item later by using remove... This can save objects in cache but can you use options like varyByParam?
My questions are burnt down to two:
Is there a way to clear the caching on specific user controls from the code? If yes, can this be done according to the varyby options? How would the object caching respond to logged in users or anonymous users using Insert()?
EDIT: I'm caching multiple things.... And I'm really flabbergasted in which choice to make referring to caching. Can the Cache.Insert be varied by Parameters?
The main problem is peopling editing things from the backend, which needs to trigger an event that reinstantiates or clears all caching items referring that object.
View 2 Replies
Feb 10, 2011
i have a usercontrol called navigationmenu whose data is static but varies with loged in1.empID 2.empType 3 Country my question is how can i cache the data of usercontrol based upon combination of these 3 parameters
View 9 Replies
Apr 8, 2010
In our .aspx pages we have user controls each control has a Sql query to fetch data. The caching mechanism to be followed says that fragment cache all the user controls and invalidate the cache based on the respective queries of the user control.How to proceed to add a query dependency to fragment cached user control?
View 1 Replies
Feb 15, 2013
I have used caching in a page that shows user name[lable] and a linkbutton[login/logout].
When user logs in this text has to be changed from code but due to caching on the page none of them is changed.label I can replace with substitution control. Is there any way out to change linkbutton text now.
View 1 Replies
Aug 18, 2010
How do I implement partial page caching with an AdRotator control? I know it's supposed to do it automatically, but I'm using the AdCreated event to handle stats, and this seems to cause the ad to be cached along with the rest of the page.
View 4 Replies
Mar 31, 2011
What's the best way to cache web site user data in asp.net 4.0? I have a table of user settings that track all kinds of user or session specific stuff like the state of UI elements (open/closed), preferences, whether some dialog has been dismissed, and so on. Since these don't change very often (for each user, anyway) but are looked up frequently it seems sensible to cache them. What's the best way? These are the options I've identified...
Store them in HttpContext.Current.Session directly (e.g. Session["setting_name"]) Store them in HttpContext.Current.Cache Use a global static dictionary, e.g. static ConcurrentDictionary<string,string> where the key is a unique userID + setting name value Store a dictionary object for each session in Session or Cache What's the most sensible way to do this? How does Session differ from Cache from a practical standpoint? Would it ever make sense to store a dictionary as a single session/cache object versus just adding lots of values directly? I would think lookups might be faster, but updates would be slower since I'd have to re-store the entire dictionary when it changed.
What problems or benefits might there be to using a global static cache? Seems like this would be the fastest, but I'd have to manage the size. I could just flush it periodically if it hits a certain size, or keep a cross reference queue and remove things oldest first when it gets to a certain size. Does this make any sense or is it just trying too hard?
View 2 Replies
Jul 2, 2010
it is possible to cache an ASP.NET UserControl on the Client.
I have an User Control that queries a DB and renders a GridView. It must be on the Client because the query results vary from user to user (by the User.Identity.Name).
View 2 Replies
Feb 15, 2012
I have been working on a site recently that relies heavily on user controls.
With the site nearly complete we are now looking to improve efficiency with some caching.
I have been looking at a number of options. In some cases a simple varybyparam fits the bill. However some user controls don't suit this model for whatever reason.
This sent me down the line of PartialCaching where I vary the cache by property.
This seems to work a treat if I declare the property in my markup, ie <uc7:JustPublished ID="JustPublished1" runat="server" categoryid="101" />
however if the control sits on a page that has a number of variants and I set the property in the codebehind eg categoryid = 101 it does not vary the cache.
View 3 Replies
Dec 8, 2010
I have a TreeView control, that for reasons of performance (it takes a LONG time to do all the database queries to build it) is being cached. The data and treeView control seem to cache just fine, EXCEPT for the RootNodeStyle.Font.Bold property. On initial page-load (when it's cached), the root nodes come out bold. However, when retrieving the TreeView control from cache, the root nodes are NOT bold (even though reading that property shows TRUE).
Here's some code:
[Code]....
The first time this code is called (i.e., when the cache is not hit and the TreeView control is populated, the resulting TreeView has its root nodes in a bold font. However, when the cache is hit, the root nodes are NOT bold (the RootNodeSTyle.Font.Bold property is True, but the output HTML is not bold).
View 5 Replies
May 24, 2010
have an ObjectDataSource with the following configuration:
[Code]....
And the 'Select' parameters will aid in making a 'unique' combination per user selection to populate the GridView it is bound to:The problem that is occurring is that GridView search results are indeed cached, but the cache is a little too public and shared between all users currently running the application. So if user1 creates a search that populates the GridView with 100 results based on some unique dates and CategoryID, and then user2 in a separate browser does another search with different dates and a different category
View 4 Replies
Oct 18, 2010
i have a custom handler which captures user's book mark entry. To debug this handler, i have created a file "test1.txt" in code behind which saves the user entry. After the debug, i removed the text file (test1.txt) then re-complied the web app and deployed new DLLs for the site. But, the site is still looking for test1.txt file. i dont know how to confirm if the handler is really removed from the new DLL. Also, looked at the handler code behind file and didn't find any entry with test1.txt. So,
View 1 Replies
Jun 4, 2010
I don't think I understand fully how ASP.NET does inheritance of controls.I have a user control, ucBase, which has an asp.net label in the ascx file. Code behind references the label and it works fine during run time if the control is not a parent for another user parent.
If I have another user control, ucChild, inheriting from ucBase, the label in ucBase's code is always null. ucChild has no controls in its ascx fileThe server controls (like the label) needs to be declared in the ascx file and not created programmatically.What needs to be done for ucBase to see its own controls when it's a parent user control?
View 1 Replies
Sep 10, 2010
I've got a web site that has a master page and that master page (mpMaster that has a user control ucControl1) which has a sub user control (ucControl2), this user control has a property which accepts a value. Now, I have a page that uses the master page
and on this page I have another user control (ucPageControl), I need to find a way of setting the value in ucControl2 from ucPageControl. Is this possible at all?
View 5 Replies
Feb 17, 2011
I am trying to assign user control from another user control ..first time its binding control successfully but when we refresh the data its giving error
saying "Object reference is not set an instance".
how to refresh data from another user control ...
My senerio below :
1 Aspx page
2. User control
calling usercontrol databinding method from aspx page but once it get refreshed ,not allowed to bind it again..
View 2 Replies
May 15, 2010
how to implement caching in wcf service using System.Web.Caching
View 2 Replies
Sep 8, 2010
We display an ASP.NET calendar control and update the color and if the day is enabled with the DayRender event. This process is a bit slow so I'm trying to map out a strategy to cache the results of the all the DayRenders. Basically take a snapshot of the calendar and cache it for X minutes. Where would I hook into the page/control workflow to accomplish this goal?
View 1 Replies
Apr 16, 2010
All I would like to be able to do is include one user control within another! Is this possible? I have spent the last hour searching the internet and it seems that I can't find a single thing.
In classic ASP it would be something like:
<!--#include file="EditProject.ascx"-->
I tried this but no luck!
Parser Error Message:
There can be only one 'control' directive.
Source Error:
[Code]....
Line 1: <%@ Control Language="VB" AutoEventWireup="false" CodeFile="EditProject.ascx.vb"Line 2: Inherits="Controls_WebUserControl" %>Line 3: <form runat="server">
View 3 Replies
Mar 22, 2011
i have 2 user control : uc1 and uc2. and i have button in uc2 i call button1, i want to set commandArgument of button1 from uc1, how can i do this?
View 5 Replies