Setting focus on control

Discussion in 'ASP .Net' started by Mike, Aug 11, 2004.

  1. Mike

    Mike Guest

    Hi,

    I have a webform with two textboxes and two buttons. I would like to set the focus to the first textbox when the page is displayed. I tried to change the TabIndex, but apparently, it does not have any effect. Any idea on how I could do that?

    Thanks
    Mike
     
    Mike, Aug 11, 2004
    #1
    1. Advertising

  2. The easiest, most reliable way is client side Javascript:

    MyControl.focus();

    Here's more info:
    http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/ref_f-g.htm#59872

    You might also consider using this free control:
    http://www.metabuilders.com/Tools/FirstFocus.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com

    "Mike" <> wrote in message news:...

    Hi,

    I have a webform with two textboxes and two buttons. I would like to set the focus to the first textbox when the page is displayed. I tried to change the TabIndex, but apparently, it does not have any effect. Any idea on how I could do that?

    Thanks
    Mike
     
    Steve C. Orr [MVP, MCSD], Aug 11, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?c2VudGhpbA==?=, Aug 11, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vinod I
    Replies:
    2
    Views:
    413
    Peter Blum
    Feb 4, 2004
  2. =?Utf-8?B?Q0xFQVItUkNJQw==?=

    setting focus to an asp.net web user control

    =?Utf-8?B?Q0xFQVItUkNJQw==?=, Dec 6, 2004, in forum: ASP .Net
    Replies:
    12
    Views:
    6,129
    Patrick Olurotimi Ige
    Dec 7, 2004
  3. Craig G
    Replies:
    2
    Views:
    386
    Saravana
    Dec 15, 2004
  4. Jason
    Replies:
    4
    Views:
    1,632
    Jason
    May 7, 2007
  5. Roger
    Replies:
    3
    Views:
    336
Loading...

Share This Page