Focus control with asp.net

G

Guest

Hi i need to write javascript to shift control focus ..... like if i enter in
textbox 1 then it set focus to textbox2 or 3 any thing ...

the other thing is how i know i can do like
mytextbox.atrribute.add("OnClick","return myfunc()");

but if i want to use enter instead of onclick ... thanks
 
C

Cowboy \(Gregory A. Beamer\)

You can grab the event in codeBehind and hijack the enter button push, if
you desire. Or you can set the target control for the enter (works well with
a button). For what you are aiming at, you will likely need to emit
JavaScript from CodeBehind and have it attach the proper event call. I don't
have an example of this right now, but I might be able to find one, as we
have "hijacked" the model quite a bit.

If you do not do this in code behind, it gets tricky as changing anything on
the form changes the name of the control, as the page sees it. If you "hard
code" in JavaScript, you are stuck with a form that canot change too much
(like encapsulating your postback textbox in a control).

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 

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

Top