?
Solved

Correct :  'Public Function IsStartupScriptRegistered(key As String) As Boolean' is obsolete

Posted on 2008-09-29
11
Medium Priority
?
1,288 Views
Last Modified: 2012-05-05
I am working in VB.Net and am getting the following error..can some body help me correcting this...

my code is
If (Not IsStartupScriptRegistered("Startup")) Then
                RegisterStartupScript("Startup", scriptString.ToString)
            End If


BC40000 : 'Public Function IsStartupScriptRegistered(key As String) As Boolean' is obsolete: 'The recommended alternative is ClientScript.IsStartupScriptRegistered(string key). http://go.microsoft.com/fwlink/?linkid=14202' in Reports.aspx.vb(41, 0)

BC40000 : 'Public Overridable Sub RegisterStartupScript(key As String, script As String)' is obsolete: 'The recommended alternative is ClientScript.RegisterStartupScript(Type type, string key, string script). http://go.microsoft.com/fwlink/?linkid=14202' in Reports.aspx.vb(42, 0)

0
Comment
Question by:Kerau
  • 6
  • 5
11 Comments
 
LVL 13

Expert Comment

by:SameerJagdale
ID: 22596111
the 2 functions are obsolete, however it will not stop you from running the application i guess.
you can change the functions to the recommended one like for IsStartupScriptRegistered("Startup")) use ClientScript.IsStartupScriptRegistered("Startup"))
and same for the second one.
0
 

Author Comment

by:Kerau
ID: 22596180
Thanks Sameer, You are correct it doesn't stop me running the application but need to eliminate the warning as well ...so i tried this

IsStartupScriptRegistered("Startup")) use ClientScript.IsStartupScriptRegistered("Startup")) works fine ..........but  when i use change the second line
RegisterStartupScript("Startup", scriptString.ToString) to ClientScript.RegisterStartupScript("Startup", scriptString.ToString)

I get the following error..
overload resolution failed because no accessible 'RegisterStartupScript' accepts this number of arguments :(
0
 
LVL 13

Expert Comment

by:SameerJagdale
ID: 22596258
try this:
ClientScript.RegisterStartupScript(typeof(string),"Startup", scriptString.ToString)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Kerau
ID: 22596279
sure thanks..i will use this and get back to u asap..:)
0
 

Author Comment

by:Kerau
ID: 22596305
says 'string' is a class type and can't be use as an expression
0
 
LVL 13

Expert Comment

by:SameerJagdale
ID: 22596359
change the first parameter to:
typeof(Page) and try
0
 

Author Comment

by:Kerau
ID: 22596412
It says type is expected ..suggests me as typeof(Page)Is??????
0
 
LVL 13

Accepted Solution

by:
SameerJagdale earned 2000 total points
ID: 22596461
i guess you are using vb.net
try this
ClientScript.RegisterStartupScript(GetType(Page), "Startup",scriptString.ToString)
0
 

Author Comment

by:Kerau
ID: 22596511
I am using VB.net :).

just a quick question...which one would you prefer /conventional way in a vb

Dim urlString As String = ""

OR

Dim urlString  = ""
0
 
LVL 13

Assisted Solution

by:SameerJagdale
SameerJagdale earned 2000 total points
ID: 22596526
Dim urlString As String = ""

if you use
Dim urlString  = ""

urlString would be considered as an object not a string.. ultimately string is an object but then it is not strongly typed.
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question