How to avoid that something be saved in cache

W

WT

Hello,

I have a dictionary made with objects which contain a control element, the
control element is added to a Page when I want to edit the dictionary
content.
I put this dictionary in cache to improve ovaral speed.
But I am using Ajax.Net and somme of my controls are registering script with
the scrip manager on the PreRender stage of the control and it appears that
the control elements, when saving the dictionary in cache, are also saved
as members of the main dictionary object.
Doing so, depending on their status at the time of caching, they seem to
save an indicator saying that Prerender as aleady been done and when I
reload from cache and try to display again theses controls, they are unable
to register their script because the indicator says that:
Script controls may not be registered after PreRender.

So I am looking for a fast way to avoid thta the control element in each
object e saved in cache ?
Isn't their some declarative syntaxe to set on the element and saying 'Don't
go in cache'

Thanks for help.

CS
 
S

Steven Cheng [MSFT]

Hi CS,

From your description, you have some ASP.NET controls that will be added
into page dynamically. Also, you currently cache these control instances in
ASP.NET cache, however, you encounter some problems when any of those
controls try registering some client script on page, correct?

Based on the error message you mentioned, the ASP.NET runtime indicate that
the script registering code has been done after page's "PreRender" stage.
For the control elements, are they your custom controls? If so, would you
show me the script registering code in those controls? Since you add those
controls in page's PreRender event(the last event we can do persistent
changes to ASP.NET page), it is possible that any other changes in your
custom controls is invoked too late.

For dynamic controls, it is recommended to be created in page's Init or
Load event so that the dynamic loaded control can also go through those
page events (such as postback event processing, ....) correctly.

#How to: Add Controls to an ASP.NET Web Page Programmatically
http://msdn.microsoft.com/en-us/library/kyt0fzt1.aspx

#HOW TO: Dynamically Create Controls in ASP.NET by Using Visual C# .NET
http://support.microsoft.com/kb/317794

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top