HELP: setting focus asp:textbox in a user control

  • Thread starter Jesper Dannemamm
  • Start date
J

Jesper Dannemamm

Hi

I am having trouble setting focus on

I tried using this script in the usercontrol's page_load sub to set focus on
a textbox with the ID = "user_name":
Page.RegisterStartupScript("focus", "<script
language=""JavaScript"">document.getElementById.user_name.focus();</script>
")

I get an error message saying that the textbox is null or not an object.

What am I doing wrong??

Regards
Jesper
 
E

Evertjan.

Jesper Dannemamm wrote on 06 dec 2003 in
microsoft.public.inetserver.asp.general:
I am having trouble setting focus on

I tried using this script in the usercontrol's page_load sub to set
focus on a textbox with the ID = "user_name":
Page.RegisterStartupScript("focus", "<script
language=""JavaScript"">document.getElementById.user_name.focus();</scr
ipt> ")

I get an error message saying that the textbox is null or not an
object.

What am I doing wrong??

ASP is serverside so does not know about focus.

Perhaps this is a ASP.NET thing, but this NG is for classical asp.

Please see a clientside javascript NG or perhaps a dotnet NG.
 
S

Steven Burn

Can't you use something alone the line's of..;

<%
If user_name="" Then
url = "focus.asp?reqd=* indicates required field&name=" & name
If name="" Then
'muser_name = the texbox name
url = url & "&user_name=*"
End if

response.redirect url & "&foobar=foobar#form"
response.end
End if
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top