473,324 Members | 1,678 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,324 software developers and data experts.

Cache User Control in Web Part

Hello everyone,

What is the best way to cache a 2.0 web part?

I tried putting output cache on the user control in the part, but the
output cache cannot be wrapped by a generic web part . . . any ideas?

I'm new to caching to begin with and I am at a loss. Because of the
control, data caching wouldn't really be a good option. Maybe if I get
the rendered html code from the control, put that in cache, then
render
that in a literal control . . . that seems a little silly (if it would
even work).

Thanks for any advice,
Ryan

Apr 20 '07 #1
5 1910
As a general rule, you don't cache the web part, you cache the data in the
web part.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Ryan" <ry*********@gmail.comwrote in message
news:11*********************@y5g2000hsa.googlegrou ps.com...
Hello everyone,

What is the best way to cache a 2.0 web part?

I tried putting output cache on the user control in the part, but the
output cache cannot be wrapped by a generic web part . . . any ideas?

I'm new to caching to begin with and I am at a loss. Because of the
control, data caching wouldn't really be a good option. Maybe if I get
the rendered html code from the control, put that in cache, then
render
that in a literal control . . . that seems a little silly (if it would
even work).

Thanks for any advice,
Ryan

Apr 20 '07 #2
Thanks Alvin! Maybe I am confused on the point of output cache . . . I
was thinking it would be simpler and quicker if the entire control was
cached. I thought that is what output cache is for. Are you saying
that output cache should not be used, or can I not do that with a web
part, so find a way around it by caching the data?

Thanks!
Ryan

On Apr 20, 5:42 am, "Alvin Bruney [MVP]" <some guy without an email
addresswrote:
As a general rule, you don'tcachethewebpart, youcachethe data in thewebpart.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon andwww.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley

"Ryan" <ryan.mcl...@gmail.comwrote in message

news:11*********************@y5g2000hsa.googlegrou ps.com...
Hello everyone,
What is the best way tocachea 2.0webpart?
I tried putting outputcacheon theusercontrolin thepart, but the
outputcachecannot be wrapped by a genericwebpart. . . any ideas?
I'm new to caching to begin with and I am at a loss. Because of the
control, data caching wouldn't really be a good option. Maybe if I get
the rendered html code from thecontrol, put that incache, then
render
that in a literalcontrol. . . that seems a little silly (if it would
even work).
Thanks for any advice,
Ryan

Apr 20 '07 #3
I think i miss read you a bit. output cache will allow this if you use the
varyby* attributes. You don't need to *wrap anything. Here is a good starter
link to understand the process:
http://authors.aspalliance.com/aspxt...roloutput.aspx

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Ryan" <ry*********@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
Thanks Alvin! Maybe I am confused on the point of output cache . . . I
was thinking it would be simpler and quicker if the entire control was
cached. I thought that is what output cache is for. Are you saying
that output cache should not be used, or can I not do that with a web
part, so find a way around it by caching the data?

Thanks!
Ryan

On Apr 20, 5:42 am, "Alvin Bruney [MVP]" <some guy without an email
addresswrote:
>As a general rule, you don'tcachethewebpart, youcachethe data in
thewebpart.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon andwww.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley

"Ryan" <ryan.mcl...@gmail.comwrote in message

news:11*********************@y5g2000hsa.googlegro ups.com...
Hello everyone,
What is the best way tocachea 2.0webpart?
I tried putting outputcacheon theusercontrolin thepart, but the
outputcachecannot be wrapped by a genericwebpart. . . any ideas?
I'm new to caching to begin with and I am at a loss. Because of the
control, data caching wouldn't really be a good option. Maybe if I get
the rendered html code from thecontrol, put that incache, then
render
that in a literalcontrol. . . that seems a little silly (if it would
even work).
Thanks for any advice,
Ryan


Apr 21 '07 #4
Hi Alvin,

I have tried putting a VaryByParam="param_name" in the OutputCache tag of the Web Part user control. But I am still getting the error:

OutputCached controls cannot be wrapped by a GenericWebPart.
Parameter name: control
May 4 '07 #5
You can't use an output cached user control as a web part, that
functionality is not supported.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
<Charissewrote in message news:u7**************@TK2MSFTNGP02.phx.gbl...
Hi Alvin,

I have tried putting a VaryByParam="param_name" in the OutputCache tag of
the Web Part user control. But I am still getting the error:

OutputCached controls cannot be wrapped by a GenericWebPart.
Parameter name: control

May 5 '07 #6

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

Similar topics

21
by: Bill H | last post by:
I have a routine that displays 60 items (with thumbnails) per page. You can click any item and displays a new page with item details. When the user back pages it runs the query again to display all...
2
by: moondaddy | last post by:
I have a user control that's used to display the products listing in the main part of a page. This control is populated with a listing of products from the database based on a category name passed...
7
by: A.M | last post by:
Hi, How can I change the duration of user control's cache inside asp.net's C# code? Any help would be apprecited, Alan
4
by: Guadala Harry | last post by:
Is there any way for one Session to remove and update objects in another Session? I seriously doubt it, but thought I'd ask. Here's why: I have some data that is unique per user (or per session -...
1
by: sam | last post by:
Hi, I know fragment caching where you can use a cached user control in a non-cached page (or the opposite) But without using a user control, how can I cache just a part of my page (two...
2
by: thehuby | last post by:
I am building a CMS and as part of it a user can upload an image. Once uploaded I am displaying the image. If the user then decides they want to replace the image with another I get a caching...
11
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses master pages. I have some pages that must not be cached on the client. In ASP.NET 1.1 I achieved this using metatags: <meta...
5
by: Stan SR | last post by:
Hi, Some newbie questions.. :-) First, what is the namespace to use for the Cache class ? When I use this bit of code I get an error if (Cache==null) Cache.Insert("myUserList",userlist);...
3
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
Here is a user control on the page, how do I cache it by user? Currently I think we could put a server control for example ID:textusername in the asp.net page whose value is username, so we can...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.