ClientScript.RegisterStartupScript Problem
-
I have the following line of code string script = " document.location = '#cv'; "; Page.ClientScript.RegisterStartupScript(GetType(String), "goToError", script.ToString()); All it does is register a javascript routine for client side scripting. All the examples that I have looked at have exactly the same way of invoking the RegisterStartupScript method, however when I try and compile my code I receive a "'string' is a 'type' but is used like a 'variable'" Error message. I have tried string and String, however all sample that I have seen use the String, What am I doing wrong that I cannot get my code to compile. This is the only compilation error message that I receive. Thanks in advance Andy Carpe Diem -- modified at 4:25 Tuesday 11th April, 2006
-
I have the following line of code string script = " document.location = '#cv'; "; Page.ClientScript.RegisterStartupScript(GetType(String), "goToError", script.ToString()); All it does is register a javascript routine for client side scripting. All the examples that I have looked at have exactly the same way of invoking the RegisterStartupScript method, however when I try and compile my code I receive a "'string' is a 'type' but is used like a 'variable'" Error message. I have tried string and String, however all sample that I have seen use the String, What am I doing wrong that I cannot get my code to compile. This is the only compilation error message that I receive. Thanks in advance Andy Carpe Diem -- modified at 4:25 Tuesday 11th April, 2006
you could always try replacing String with this
-
I have the following line of code string script = " document.location = '#cv'; "; Page.ClientScript.RegisterStartupScript(GetType(String), "goToError", script.ToString()); All it does is register a javascript routine for client side scripting. All the examples that I have looked at have exactly the same way of invoking the RegisterStartupScript method, however when I try and compile my code I receive a "'string' is a 'type' but is used like a 'variable'" Error message. I have tried string and String, however all sample that I have seen use the String, What am I doing wrong that I cannot get my code to compile. This is the only compilation error message that I receive. Thanks in advance Andy Carpe Diem -- modified at 4:25 Tuesday 11th April, 2006
-
I have the following line of code string script = " document.location = '#cv'; "; Page.ClientScript.RegisterStartupScript(GetType(String), "goToError", script.ToString()); All it does is register a javascript routine for client side scripting. All the examples that I have looked at have exactly the same way of invoking the RegisterStartupScript method, however when I try and compile my code I receive a "'string' is a 'type' but is used like a 'variable'" Error message. I have tried string and String, however all sample that I have seen use the String, What am I doing wrong that I cannot get my code to compile. This is the only compilation error message that I receive. Thanks in advance Andy Carpe Diem -- modified at 4:25 Tuesday 11th April, 2006
-
Hi As i far as i have used Page.RegisterStartupScript take 2 parameters one is key value and the other is the script as string. Can you try executing removing gettype(string). cheese
-
The
GetType
method takes a stringobject
like"String"
, not the typeString
as the method parameter. If you use the type, you may use thetypeof
operator instead.Thanks for the help, so I understand that it should be RegisterStartupScript(typeof(String), param2, param3) Or RegisterStartupScript(GetType("String"), param2, param3) instead of RegisterStartupScript(GetType(String), param2, param3) Appreciate the help Andy Carpe Diem