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
 
Back
Top