Setting focus of a control

Discussion in 'ASP .Net' started by =?Utf-8?B?YmJkb2J1ZGR5?=, Aug 1, 2005.

  1. Hi,

    I have a textbox in which in the TextChanged event I check to make sure they
    entered in valid data, however if the data isn't entered properly I want the
    cursor to go back to that text so they can fix the error.

    Any ideas on how to do this?

    Regards
    Brian
    =?Utf-8?B?YmJkb2J1ZGR5?=, Aug 1, 2005
    #1
    1. Advertising

  2. Brian,

    Add a hidden input and set it on the server side to the client id of the
    control you want to set focus on. On client side, check the input in the
    body's onload event and set the focus with

    document.getElementById(hiddenInput.value).focus();

    Eliyahu

    "bbdobuddy" <> wrote in message
    news:...
    > Hi,
    >
    > I have a textbox in which in the TextChanged event I check to make sure

    they
    > entered in valid data, however if the data isn't entered properly I want

    the
    > cursor to go back to that text so they can fix the error.
    >
    > Any ideas on how to do this?
    >
    > Regards
    > Brian
    Eliyahu Goldin, Aug 1, 2005
    #2
    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:
    403
    Peter Blum
    Feb 4, 2004
  2. Mike

    Setting focus on control

    Mike, Aug 11, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    372
    =?Utf-8?B?c2VudGhpbA==?=
    Aug 11, 2004
  3. =?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,103
    Patrick Olurotimi Ige
    Dec 7, 2004
  4. Jason
    Replies:
    4
    Views:
    1,590
    Jason
    May 7, 2007
  5. Roger
    Replies:
    3
    Views:
    306
Loading...

Share This Page