473,738 Members | 11,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with OutputCache declaration in User Control

I have the following scenario:

I have a user control that contains a registered menu control. The menu and
other information on the user control is specific to the user accessing the
site. This user control is used on many pages. In order to create this
control, I need to access information in the Active Directory to create both
the menu and other info displayed on the control.

This access takes some time and I wanted to cache this info the first time
the control is accessed and save it for access to additional pages with the
control, to speed things up. I was originally looking at cache namespace but
from what I understand, this caching is more for application wide issues.
This data is user specific (session specific).

I have been trying to use the <%@ OutputCache ......... %> declaration on
the user control page. But it has trouble after the first access (when
accessing cache), getting a unknown object error. The menu is registered to
the page. I read about the following issue that may be similar (someone
accessing a javascript ‘page’ declarative):

Since the control is loaded from cache there is no way that the code will
load as well since it's in a different container: the page instead of the
user control.

The suggestion was to put the script block inside the user control's
container.

If this can be done, how is this done? If not, does anyone having
suggestions on obtaining the results I want even if doesn't entail using the
OutputCache declarative.

Thanks,
Barbara Alderton
Nov 18 '05 #1
1 2159
I decided to drop the <%@ OutputCache ......... %> usage.

Instead I retrieve the information at Session_start and store in an
arraylist of records (class definition). Then in the user control I access
the data in the arraylist to build the menu. Speeds things up dramatically.

Barbara Alderton

"Barbara Alderton" wrote:
I have the following scenario:

I have a user control that contains a registered menu control. The menu and
other information on the user control is specific to the user accessing the
site. This user control is used on many pages. In order to create this
control, I need to access information in the Active Directory to create both
the menu and other info displayed on the control.

This access takes some time and I wanted to cache this info the first time
the control is accessed and save it for access to additional pages with the
control, to speed things up. I was originally looking at cache namespace but
from what I understand, this caching is more for application wide issues.
This data is user specific (session specific).

I have been trying to use the <%@ OutputCache ......... %> declaration on
the user control page. But it has trouble after the first access (when
accessing cache), getting a unknown object error. The menu is registered to
the page. I read about the following issue that may be similar (someone
accessing a javascript ‘page’ declarative):

Since the control is loaded from cache there is no way that the code will
load as well since it's in a different container: the page instead of the
user control.

The suggestion was to put the script block inside the user control's
container.

If this can be done, how is this done? If not, does anyone having
suggestions on obtaining the results I want even if doesn't entail using the
OutputCache declarative.

Thanks,
Barbara Alderton

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1307
by: julientuhuteru | last post by:
Hi! I'm caching multiple versions of a user control with the following directive in the ascx: <%@ OutputCache Duration="200" VaryByControl="PrgCtrlDropDown" %> "PrgCtrlDropDown" is the ID of a DropDownList. Everything seems to be working. Except when a user control is removed from the cache after 200 seconds, the SelectedIndexChanged event isn't fired. Does anybody know
3
2268
by: marshal | last post by:
Hi to All, I am using <% @ OutputCache Duration="60" VaryByParam="none" %> in my usercontrol say "myControl.ascx". This user control has a property say "title". Now am Dynamically Loading this control in "myPage.aspx" like this
6
2742
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache directive to vary its cache based on that property value? I.e., I have: <my:control runat="server" id="mcOne" Flag="One" /> <my:control runat="server" id="mcTwo" Flag="Two" />
2
1509
by: moondaddy | last post by:
My default page stays constant in the site and all the content in the body of the page is produced with user controls in a table cell for the body section. The main function of this site is a products catalogue and the products show in a datagrid in one of the user controls. This datagrid has many rows and columns of images and this is what I'm most interested in caching. If I put <%@ OutputCache Duration="500" VaryByParam="MenuID"...
0
1182
by: Bob | last post by:
I have several simple user controls (e.g. header, footer) that have static content so I thought it would be a good idea to turn on the ouput cache. So I added <%@ OutputCache Duration="600" Shared="True" VaryByParam="none" %> to the control. I have a base page class that overrides the Render() method to load these controls: protected override void Render(HtmlTextWriter writer) { ......... LoadControl(Config.AppRoot +...
4
1939
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
0
1933
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
3
3591
by: =?Utf-8?B?TWlndWVsIElzaWRvcm8=?= | last post by:
Hi, I have an ASP.NET 2.0 application that allows content search. Search is included in all pages and a cross postback to the search results page is performed with the text inserted by the user. The search results also allows refining the search and a search button that performs a postback triggers the search. Many of the web pages in the web site have an OutputCache directive and the search results page does not. When I run the first...
0
1056
by: yashgt | last post by:
Hi, I have a user control MyControl.ascx which appears on various pages in my ASP .NET 2.0 application. I have setup partial-page caching using OutputCache directive so that this control gets cached on each page. However, there is one page Update.aspx which contains the control and has features that update the DB entries that determine the output of the control. I have set SqlDependency so that the control's cache is expired when
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.