RegisterClientScript from a User COntrol

J

Jawahar

All
We have an in-house web application that uses several User controls on a
single web page!
So each time the page loads the Page_load events of all the user cotrols
also fire.
One of the controls uses RegisterClientScript in its page_Load event. This
is fine when the control is visible but not otherwise. we often get
Javascript errors from script functins that are trying to refer to the user
control when it is no longer visible. The script the User control emmited is
still there on the main page.

Is there a way of unregistering the script block?
I.E. the oppisite of RegisterClientScript. I have tried to use the
IsClientScriptRegitered but this is not working as I expect. Is this because
I am using a user control rather than a regular Web Page?

Any help is appreciated

Jawahar Rajan
 
M

Marcel

Since RegisterClientScriptBlock is virtual you can overwrite it and
store all key/script collections in your own
dictionaryentry-collection.

Add your own function to remove an script item for a given key.

At the last momoment, register all script blocks using the base-class
implementation of RegisterClientScriptBlock.

Hope this is helpfull...

Marcel van Eijkel
( www.vaneijkel.com )
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top