SetFocus convert from 2003 to 2005 problem


G

gnewsham

I am converting an application from vb.net 2003 to 2005
I have the following function which I call when an input error is
detected:

Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)
Dim s As String = "<SCRIPT
language='javascript'>document.getElementById('" & ctrl.ID &
"').focus() </SCRIPT>"
RegisterStartupScript("focus", s)
End Sub


This is how it is called:


Me.SetFocus(controlName)

I am getting the following warnings and am unsure how to correct them:


Warning 1 sub 'SetFocus' shadows an overloadable member declared in the
base class 'Page'. If you want to overload the base method, this
method must be declared 'Overloads'.

Warning 2 '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'

With warning 2 I tried the suggested alternative but then it complains
about incorrect number of arguments??

Help! - Thanks
 
Ad

Advertisements

B

bruce barker \(sqlwork.com\)

vs2005 has this feature builtin. use the builtin or change the name of your
routine.

-- bruce (sqlwork.com)
 
Ad

Advertisements

P

Problematic coder

Thanks for taking the time to respond, I changed the name of the
function as suggested and that did the trick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top