473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

caching and user controls

I am trying to use PartialCaching on a user control that has a image string
property, I want cache different versions of the user control by the image
string property but it fails to load the control when using the
'Page.LoadControl' method.

Pseudo code shown below:

[PartialCaching(60, null, "ImageURL", null)]
public class WizardIntro : System.Web.UI.WebControls.UserControl
{
protected System.Web.UI.WebControls.Image imWizardStage;
protected System.Web.UI.WebControls.Literal ltWizardText;

Public string ImageURL
{
get
{
return m_imageURL;
}
set
{
m_imageULR = value;
}
}

private void Page_Load(object sender, System.EventArgs e)
{
....
....
}

.....
.....
}
Anyone have any ideas?
Cheers

Ollie Riches
Nov 19 '05 #1
2 1300
You could have posted the code which was crashing.

However I believe LoadControl will return an instance of
System.Web.UI.PartialCachingControl rather than your own Control. You
then need to reference the CachedControl property to pull out the
control.. eg

Control control = LoadControl ("MyControl.ascx");

MyControl myControl;
if (control is PartialCachingControl)
{
PartialCachingControl cacheControl = control as
PartialCachingControl;
myControl = (MyControl) cacheControl.CachedControl;
}
else
{
myControl = (MyControl) control;
}

Nov 19 '05 #2
thanks for the help

Ollie Riches

<nm*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
You could have posted the code which was crashing.

However I believe LoadControl will return an instance of
System.Web.UI.PartialCachingControl rather than your own Control. You
then need to reference the CachedControl property to pull out the
control.. eg

Control control = LoadControl ("MyControl.ascx");

MyControl myControl;
if (control is PartialCachingControl)
{
PartialCachingControl cacheControl = control as
PartialCachingControl;
myControl = (MyControl) cacheControl.CachedControl;
}
else
{
myControl = (MyControl) control;
}

Nov 19 '05 #3

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

Similar topics

3
by: Janaka | last post by:
Hi All, I'm having a problem with Page Output caching on a page that contains a DataGrid. Basically the page pulls up some data for sales information from the DB. Some of this has to be...
2
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...
0
by: Jeff Schaefer | last post by:
What I want to know is this: Is it possible to programmatically manipulate a custom property of a user control for which <%@ OutputCache ... > has been included? If so, then how? My brief code is...
2
by: Welman Jordan | last post by:
Hello, I met with a tough problem when making my pages. Please help. To make the problem short, i write down what i want here first, and then explain my situation in details. How can I...
0
by: Chris | last post by:
I've been playing with the fragment caching and it seems to work fine. I have a user control that I set to cache. The user control has a few text boxes and a drop down list box populated from a...
0
by: Jonathan Carter | last post by:
I was recently searching for a solution on how to perform an output caching-like solution on a custom control. Obviously the OutputCache directive wasn't available, and I tried using the Response's...
0
by: Ed | last post by:
Hi all, Have a strange situation regarding fragment caching. I've read the docs and kbs on this so it's either I've missed some key aspect of the implementation or there is a "gotcha" here that...
1
by: Aryan | last post by:
Hi, I have problem related to Caching of data. I am reading large xml file and putting this xml in dataset, since this dataset will contain many datatable's inside. And each datatable might be big...
2
by: Aryan | last post by:
Hi, I have problem related to Caching of data. I am reading large xml file and putting this xml in dataset, since this dataset will contain many datatable's inside. And each datatable might be big...
0
by: helveticus | last post by:
I have a master/details configuration that includes multiple user controls. The details page is configured to cache data via VaryByCustom. This works fine. One of the user controls contains an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.