CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: TaxtBox Focus

  1. #1
    Join Date
    Jul 2001
    Posts
    27

    TaxtBox Focus

    I am using VisualBasic.net to create ASP web applicaiton form. please tell me how i can put my cursor in the TextBox1 when first my web page loads in browser.

    Kindly tell me if you have any link for free step by step beginer e-book for ASP and VB.net

    Thank you.

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: TaxtBox Focus

    You will have to use Client javascript to do that
    Code:
    Page.RegisterStartupScript("setFocus", "<script>document.getElementById('" & TextBox1.ClientID & "').focus();</script>")
    Take a look at RegisterStartupScript Method of the Page Object to understand what happens when you call this method.

  3. #3
    Join Date
    Apr 2000
    Location
    Washington (state)
    Posts
    125

    Re: TaxtBox Focus

    Used this in C# too... it worked perfectly!

    Page.RegisterStartupScript("setFocus", "<script>document.getElementById('" + Textbox1.ClientID + "').focus();</script>");

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)