This will do it, just add it to the load event of your User Control:
If (Page.IsClientScriptBlockRegistered("Focus") = False) Then
MyBase.Page.RegisterStartupScript("Focus", "<script
language='javascript'>document.getElementById('" + TextBox1.ClientID +
"').focus();</script>")
End If
Be sure to use control.ClientID and not just hard code the control id
because ASP.Net will change the control id inside a User Control to somthing
like "_ctl0_controlid". Good luck! Ken.
If it still doesn't work then do a view source on your page and post the
outputted HTML. It'll be just above the clsoing </form> tag. Ken.
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.