remove a script registered with RegisterStartupScript

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
Is there any way to replace a script I registered in Page Load with the
method Page.RegisterStartupScript
 
This question is a bit confusing. The RegisterStartupScript method takes a
string and adds it to the page as a startup script, by inserting it at the
bottom of the form. You say you want to "replace" it. Now, as it is only
"placed" when you call the method, all you have to do is use a different
script string when you call the method. Assuming you only call the method
one time, and pass only one string to it, whichever string you pass to it
will be the one placed in the Page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
Actually this's not exactly what happens when u call the
RegisterStartupScript twice.
If u called it twice, only the first call will appear. the second one (which
is intended to replace the first one) won't be registered when the same key
is used.

I found another work around for my problem, but I am really interested to
find a solution for this problem.
 
I didn't say to call it twice. You only need to call it once. Why on earth
would you want to have your app execute an instruction that you don't intend
for it to follow? That is what you're asking. In essence, you are saying, "I
tell my app to insert this script, and I want to know how to tell it
afterwards to insert a different script, rather than the one I already told
it to insert." Instead, you should determine which script you really want to
insert, and tell it to insert that one. Once.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
I actually do want to know how to replace the script, and call it again
with a different tagname. So if someone has a solution to this I would
love to hear it.

Andrea
 
I actually do want to know how to replace the script, and call it again
with a different tagname. So if someone has a solution to this I would
love to hear it.

Andrea
 

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

Back
Top