Re: remove a script registered with RegisterStartupScript

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.

"Ahmed" <Ahmed@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E14F0B67-FF52-490F-AB0E-1D4DA9C2E3D8@xxxxxxxxxxxxxxxx
> 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.
>
> "Kevin Spencer" wrote:
>
>> 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.
>>
>> "Ahmed" <Ahmed@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:62D8BB40-5BA6-46DD-97E3-108ADEC98340@xxxxxxxxxxxxxxxx
>> > Hi all,
>> > Is there any way to replace a script I registered in Page Load with the
>> > method Page.RegisterStartupScript
>>
>>
>>


.



Relevant Pages

  • Re: RegisterStartupScript
    ... > comma-separated list of values as a string. ... The second parameter is a string containing the script to be sent ... > first parameter is a string that provides the input control's name. ... > RegisterStartupScript Inserts a script block just before the closing ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: RegisterStartupScript
    ... comma-separated list of values as a string. ... The second parameter is a string containing the script to be sent to ... You must include the tags. ... RegisterStartupScript Inserts a script block just before the closing ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: remove a script registered with RegisterStartupScript
    ... RegisterStartupScript twice. ... > script string when you call the method. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to rewrite with awk?
    ... > I'm unfamiliar with tools such as sed & awk. ... Extract the string that matches a RE. ... This script will not only expand all the lines that say "include ... file) and not resetting ARGV(the tmp file), it then lets awk do any ...
    (comp.unix.shell)
  • Re: Slow string
    ... I see virtually no difference in execution time for the code you posted when using cscript versus using wscript; to confirm, I bracketed the code with an initial ... Are you actually entering the script name into a console window? ... You can use the exact same line for every wrapper script - and that includes wsf and js scripts; all you need to do is change the final "vbs" to "wsf" or "js" as appropriate. ... If you build a large string by small concatenations, the performance degrades geometrically - so does array resizing, because they both use the same nasty technique inherited from VB1 of copying the entire data structure to a new structure with the added element. ...
    (microsoft.public.scripting.vbscript)