How to programatically set focus onto a web control ?

Discussion in 'ASP .Net Web Controls' started by, Nov 26, 2004.

  1. Guest


    I have a form containing a number of panels, simulating a wizard
    (simulating, actually, a multi-page form). After pressing a button called
    "Next", I am showing a new panel on this form, loaded with some controls. I
    need to set the focus onto a textbox in the newly shown panel right away,
    without "asking" the user to tab (or to click) his way towards my textbox.
    So please, how can I set the focus programatically on any control on my form

    Maybe using "FindControl" ?? And then ?

    Thank you
, Nov 26, 2004
    1. Advertisements


    David Jessee Guest

    in the button's handler, put something like...

    be careful. If your text box us called text1 and its inside panel1 then the
    clientID might be something like panel1:text1

    You'll want to either do a View>>Source on your HTML to see what the client
    ID is, or use the Test Box's ClientID property
    David Jessee, Nov 26, 2004
    1. Advertisements

  3. Ken Cox [Microsoft MVP], Nov 26, 2004
  4. Guest

    Thanks a lot for your answers. :)))

, Dec 2, 2004

    Ryan De Laet Guest

    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.