Results 1 to 2 of 2

Thread: Set Focus on text box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    Malaysia
    Posts
    124

    Question Set Focus on text box

    Hi, can anyone tell me how to set cursor focus to one textbox eg. textbox1 after the form has been posted back?

    In windows form using vb.net, we could use textbox1.setfocus(), but it seems cannot find this in asp.net.


    Thanks!

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Focus of a textbox can only be acheived by using javascript.
    VB Code:
    1. Page.RegisterStartUpScript("setBoxFocus","var x = document.getElementById('" & myTextBox.clientID & "'); x.setFocus();")
    Last edited by nemaroller; Mar 31st, 2004 at 07:36 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width