PC Review


Reply
Thread Tools Rate Thread

Caching ascx control (2.0)

 
 
Tomasz J
Guest
Posts: n/a
 
      23rd Jan 2008
Hello Developers,

Is it possible to vary ascx control cache base on that control's public
property.
My control has a public Color property, and I want to vary cache based this
property, rather than any particular contained control or query parameter.
Thank you for any hints.

Tomasz J


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      23rd Jan 2008
Hi Tomasz,

From your description, you'd like to cache an ascx userconttrol on your
page and also control the cache period through a certain property of the
control, correct?

So far based on my understanding, the usercontrol cache will support the
following cache conditions:

*VaryByCustom
*VaryByHeader
*VaryByParam
*VaryByControl

#@ OutputCache
http://msdn2.microsoft.com/en-us/library/hdxfb6cy(VS.71).aspx

#Caching Portions of an ASP.NET Page
http://msdn2.microsoft.com/en-us/library/h30h475z(VS.71).aspx

and for your scenario, I think you may consider store the Color property
into a certain control's property and set that control via the
"VaryByControl" condition. How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: "Tomasz J" <(E-Mail Removed)>
>Subject: Caching ascx control (2.0)
>Date: Wed, 23 Jan 2008 03:05:34 +0100
>
>Hello Developers,
>
>Is it possible to vary ascx control cache base on that control's public
>property.
>My control has a public Color property, and I want to vary cache based

this
>property, rather than any particular contained control or query parameter.
>Thank you for any hints.
>
>Tomasz J
>
>
>


 
Reply With Quote
 
Tomasz J
Guest
Posts: n/a
 
      23rd Jan 2008
Thanks,

Well, Color was just an example - not the best one, since many controls have
this property.
Let's say that my ascx control has one custom property:

public string MyCustomProperty {get; set;}

and it contains Literal controls only.

I need to cache a different version of my control for every MyCustomProperty
value.

Tomasz


"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:7%(E-Mail Removed)...
> Hi Tomasz,
>
> From your description, you'd like to cache an ascx userconttrol on your
> page and also control the cache period through a certain property of the
> control, correct?
>
> So far based on my understanding, the usercontrol cache will support the
> following cache conditions:
>
> *VaryByCustom
> *VaryByHeader
> *VaryByParam
> *VaryByControl
>
> #@ OutputCache
> http://msdn2.microsoft.com/en-us/library/hdxfb6cy(VS.71).aspx
>
> #Caching Portions of an ASP.NET Page
> http://msdn2.microsoft.com/en-us/library/h30h475z(VS.71).aspx
>
> and for your scenario, I think you may consider store the Color property
> into a certain control's property and set that control via the
> "VaryByControl" condition. How do you think?
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
>
> ==================================================
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
>
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> --------------------
>>From: "Tomasz J" <(E-Mail Removed)>
>>Subject: Caching ascx control (2.0)
>>Date: Wed, 23 Jan 2008 03:05:34 +0100
>>
>>Hello Developers,
>>
>>Is it possible to vary ascx control cache base on that control's public
>>property.
>>My control has a public Color property, and I want to vary cache based

> this
>>property, rather than any particular contained control or query parameter.
>>Thank you for any hints.
>>
>>Tomasz J
>>
>>
>>

>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      24th Jan 2008
Thanks for your reply Tomasz,

Yes, the property on which you want to cache depend may vary, however,
since you'd like to adopt the built-in cache feature, you may try mappijng
your property value to one of those possible cache parameters(http get/get
value, Control property, ....).

Originally, I've thought about two means:

1. use an additional hidden TextBox control in the usercontrol(which
contains your certain custom property value) so that cache can rely on it.

2. You can programmatically use code to add some flag(your custom control's
value into cookie) and use the "VaryByCustom" option to programmatically
read cookie collection to determine how to cache, here is a article about
this:

http://codebetter.com/blogs/darrell..../04/12724.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Tomasz J" <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<7#(E-Mail Removed)>
>Subject: Re: Caching ascx control (2.0)
>Date: Wed, 23 Jan 2008 12:19:04 +0100


>
>Thanks,
>
>Well, Color was just an example - not the best one, since many controls

have
>this property.
>Let's say that my ascx control has one custom property:
>
>public string MyCustomProperty {get; set;}
>
>and it contains Literal controls only.
>
>I need to cache a different version of my control for every

MyCustomProperty
>value.
>
>Tomasz
>
>
>"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
>news:7%(E-Mail Removed)...
>> Hi Tomasz,
>>
>> From your description, you'd like to cache an ascx userconttrol on your
>> page and also control the cache period through a certain property of the
>> control, correct?
>>
>> So far based on my understanding, the usercontrol cache will support the
>> following cache conditions:
>>
>> *VaryByCustom
>> *VaryByHeader
>> *VaryByParam
>> *VaryByControl
>>
>> #@ OutputCache
>> http://msdn2.microsoft.com/en-us/library/hdxfb6cy(VS.71).aspx
>>
>> #Caching Portions of an ASP.NET Page
>> http://msdn2.microsoft.com/en-us/library/h30h475z(VS.71).aspx
>>
>> and for your scenario, I think you may consider store the Color property
>> into a certain control's property and set that control via the
>> "VaryByControl" condition. How do you think?
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>>
>>
>> ==================================================
>>
>> Get notification to my posts through email? Please refer to
>>

http://msdn.microsoft.com/subscripti...ult.aspx#notif
>> ications.
>>
>>
>>
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent

issues
>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each

follow
>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach the
>> most efficient resolution. The offering is not appropriate for situations
>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are best
>> handled working with a dedicated Microsoft Support Engineer by contacting
>> Microsoft Customer Support Services (CSS) at
>> http://msdn.microsoft.com/subscripti...t/default.aspx.
>>
>> ==================================================
>>
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> --------------------
>>>From: "Tomasz J" <(E-Mail Removed)>
>>>Subject: Caching ascx control (2.0)
>>>Date: Wed, 23 Jan 2008 03:05:34 +0100
>>>
>>>Hello Developers,
>>>
>>>Is it possible to vary ascx control cache base on that control's public
>>>property.
>>>My control has a public Color property, and I want to vary cache based

>> this
>>>property, rather than any particular contained control or query

parameter.
>>>Thank you for any hints.
>>>
>>>Tomasz J
>>>
>>>
>>>

>>

>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
set control value in ascx Peter Microsoft C# .NET 1 25th Sep 2008 04:05 PM
feeding a SQLDataSource embedded in an .ascx user control a custom property assigned to that control Microsoft ASP .NET 4 16th Jul 2006 01:20 PM
Turning an .ascx User Control into a Redistributable Custom Control ElSchepo@gmail.com Microsoft Dot NET 0 25th Jan 2006 08:27 AM
Best Practices: Porting ASCX control to compiled Custom Control? David Bowey Microsoft ASP .NET 1 16th Mar 2005 01:33 AM
How do i position a user control - ascx control. John Blair Microsoft ASP .NET 2 29th Jan 2005 07:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 PM.