Setting control focus programatically on an aspx page

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to set the focus to a control programatically in my code
for an asp.net app?
 
Todd

I do it this way (I cannot do it from "code behind" because that it has to
be runned as last)

<INPUT tabindex="1" id="fieldid" type="text" size="27">
fieldid is just the name of the control

//This should be the last rows in your html aspx file

<script language="JavaScript">
document.all("fieldid").focus();
</script>
</HTML>

I hope this helps a little bit?

Cor
 

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

Back
Top