Solved

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

Posted on 2008-09-29
11
1,211 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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 500 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 500 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
 

Author Comment

by:Kerau
ID: 22653206
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

785 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