Home All Groups Group Topic Archive Search About

ClientScript.RegisterClientScriptBlock in ASP.NET 2.0

Author
3 Jul 2006 1:00 AM
Nathan Sokalski
I am working on converting my code from ASP.NET 1.1 to ASP.NET 2.0. In
ASP.NET 1.1 the RegisterClientScriptBlock method was just a key and script
(2 Strings), but in ASP.NET the ClientScript.RegisterClientScriptBlock also
includes a parameter called 'type' which is of Type. This sounds like it is
supposed to specify whether the script is JavaScript, VBScript, JScript,
ECMAScript, etc., but I what am I supposed to enter here (I have not heard
of a value of Type that would specify this)? (I always use JavaScript for my
client-side scripts) Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Author
3 Jul 2006 1:29 AM
Ken Cox [Microsoft MVP]
Hi Nathan,

Try it like this:

        ClientScript.RegisterStartupScript(Me.GetType, "Startup",
scriptString)


Ken
Microsoft MVP [ASP.NET]

Show quoteHide quote
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
news:OITliwjnGHA.2264@TK2MSFTNGP04.phx.gbl...
>I am working on converting my code from ASP.NET 1.1 to ASP.NET 2.0. In
>ASP.NET 1.1 the RegisterClientScriptBlock method was just a key and script
>(2 Strings), but in ASP.NET the ClientScript.RegisterClientScriptBlock also
>includes a parameter called 'type' which is of Type. This sounds like it is
>supposed to specify whether the script is JavaScript, VBScript, JScript,
>ECMAScript, etc., but I what am I supposed to enter here (I have not heard
>of a value of Type that would specify this)? (I always use JavaScript for
>my client-side scripts) Thanks.
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
Author
3 Jul 2006 3:53 AM
daniel #
Hi Nathan

RegisterClientScriptBlock doesn't know about client side scripting, the
parameter type is the object 'type', You usually get this with GetType()
method.

See ya
daniel #

Show quoteHide quote
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
news:OITliwjnGHA.2264@TK2MSFTNGP04.phx.gbl...
>I am working on converting my code from ASP.NET 1.1 to ASP.NET 2.0. In
>ASP.NET 1.1 the RegisterClientScriptBlock method was just a key and script
>(2 Strings), but in ASP.NET the ClientScript.RegisterClientScriptBlock also
>includes a parameter called 'type' which is of Type. This sounds like it is
>supposed to specify whether the script is JavaScript, VBScript, JScript,
>ECMAScript, etc., but I what am I supposed to enter here (I have not heard
>of a value of Type that would specify this)? (I always use JavaScript for
>my client-side scripts) Thanks.
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>