How may I set the focus to a textbox on my ASP.NET webform ?

Discussion in 'ASP .Net' started by Eddie, May 31, 2004.

  1. Eddie

    Eddie Guest

    How may I set the focus to a textbox on my ASP.NET webform ?
    Probably with Javascript, but I dont know how...

    Any exemples ???

    Thx
     
    Eddie, May 31, 2004
    #1
    1. Advertisements

  2. Eddie

    BluDog Guest

    How may I set the focus to a textbox on my ASP.NET webform ?
    Are you talking about serverside (i.e. after a postback) or client
    side (e.g. after the user has clicked on a button or something that is
    handled through clientside scripting)?

    Cheers

    Blu
     
    BluDog, May 31, 2004
    #2
    1. Advertisements

  3. Eddie

    avnrao Guest

    write this in code behind..

    RegisterStartupScript("Set focus","<script
    language='javascript'>document.forms('formname').controlname.focus();</script>");

    Av.
     
    avnrao, May 31, 2004
    #3
  4. Eddie

    Eddie Guest

    I'm talking about Serverside AND clientSide :eek:)

    Sometimes I need to set the focus on a textbox after a postback, and
    sometimes I need to set the focus on a textbox after a clientsite
    validation...

    Thx...
     
    Eddie, May 31, 2004
    #4
  5. Ken Cox [Microsoft MVP], Jun 2, 2004
    #5
    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.