Control Focus Question???

Discussion in 'ASP .Net Web Controls' started by inetmug, Mar 9, 2005.

  1. inetmug

    inetmug Guest

    I have a form with two buttons, and two textboxes. When you are in either
    textbox one of the buttons gets focus (blue ring around edges). What is
    making the FIRST textbox that was added to the form get the focus? The
    second one added does not behave this way.

    Also, I noticed that the page.Validate method is also getting fired along
    with the TextChanged event when this happens. I have read that the textbox
    control itself does not cause validation. jHowever, I clearly see the
    page.Validate method firing (because I overrode it to put out some text, and
    called the base method).

    Thanks

    --
    Patrick
     
    inetmug, Mar 9, 2005
    #1
    1. Advertising

  2. inetmug

    inetmug Guest

    Thanks much Peter.

    "Peter Blum" wrote:

    > Within <form> tags, the first <input type='submit'> tag is the default
    > button with that special formatting. It is used when the user hits ENTER
    > while focus is not on any button. You cannot change this through HTML. You
    > must write javascript to capture the onkeypress event, usually on the <body>
    > or <form> tag, look for the keyCode for ENTER (#13) and call the click
    > method on the desired button. There are numerous examples on the www.asp.net
    > forums (search "onkeypress" and "enter") and I'm sure published in articles
    > on Google.
    >
    > When a button is clicked, its server side code calls Page.Validate after the
    > Page_Load method but before calling your Click post back event. If you don't
    > want that to happen, sets the buttons' CausesValidation property to false.
    >
    > --- Peter Blum
    > www.PeterBlum.com
    > Email:
    > Creator of "Professional Validation And More" at
    > http://www.peterblum.com/vam/home.aspx
    >
    > "inetmug" <> wrote in message
    > news:...
    > >I have a form with two buttons, and two textboxes. When you are in either
    > > textbox one of the buttons gets focus (blue ring around edges). What is
    > > making the FIRST textbox that was added to the form get the focus? The
    > > second one added does not behave this way.
    > >
    > > Also, I noticed that the page.Validate method is also getting fired along
    > > with the TextChanged event when this happens. I have read that the
    > > textbox
    > > control itself does not cause validation. jHowever, I clearly see the
    > > page.Validate method firing (because I overrode it to put out some text,
    > > and
    > > called the base method).
    > >
    > > Thanks
    > >
    > > --
    > > Patrick

    >
    >
    >
     
    inetmug, Mar 9, 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. Jason
    Replies:
    4
    Views:
    1,644
    Jason
    May 7, 2007
  2. Replies:
    2
    Views:
    346
    Thomas 'PointedEars' Lahn
    Jun 6, 2005
  3. Roger
    Replies:
    3
    Views:
    345
  4. Jeff

    manual focus vs. focus()

    Jeff, May 20, 2007, in forum: Javascript
    Replies:
    4
    Views:
    188
  5. Spizzat2
    Replies:
    2
    Views:
    189
    Spizzat2
    Jan 9, 2008
Loading...

Share This Page