Focus after postback

liunx

Guest
Focus after postback

How can i set focus or send the cursor to a specific control on the page after postback?
let say that i have a textbox and a button next to it then another textbox below.

------------- --------
Text box button
------------- --------

-------------
Text box
-------------

after i click the button (server side) i want to send the cursor to the textbox below..
I don't want to start from the beggining when i press Tap..

Can anyone help me please?Hi,

I would put a javascript between your <head> tag at ur aspx page.

this is the code I use with my site (i refer it as loginBox:txtuser because it is a ascx web user control from my aspx, if u only have a aspx doc, just refer the control name directly)

<!--
function setFocus() {document.forms[0]['loginBox:txtUser'].focus(); }
window.onload=setFocus;
//-->thanks sirpelidor.. :)
i thought i can do that using vb.net only.. sometime you can do nice things using javascript..

thanks again and happy programming ;)
 
Back
Top