Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. set cursor

set cursor

Scheduled Pinned Locked Moved ASP.NET
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kani98
    wrote on last edited by
    #1

    Does anyone know how I can set the mouse cursor to the first textbox after my webpage has finished loading? Thanks.

    G D 2 Replies Last reply
    0
    • K kani98

      Does anyone know how I can set the mouse cursor to the first textbox after my webpage has finished loading? Thanks.

      G Offline
      G Offline
      god_bless_the_world
      wrote on last edited by
      #2

      Look in this site: http://searchvb.techtarget.com/vsnetTip/1,293823,sid8\_gci864207\_tax293033,00.html or type 'setting the focus on an ASP.NET page' in google and hit search...you will get this page. In faith there is enough light for those who want to believe and enough shadows to blind those who don't. - Blaise Pascal

      1 Reply Last reply
      0
      • K kani98

        Does anyone know how I can set the mouse cursor to the first textbox after my webpage has finished loading? Thanks.

        D Offline
        D Offline
        Daniel Santillanes
        wrote on last edited by
        #3

        You need to add the following in codebehind: RegisterStartUpScript("SetCursor","<SCRIPT>var textbox1 = document.getElemenById('textbox1'); textbox1.focus();</SCRIPT>") Where... well, it should work just fine by adding it in the page_load event. You need to look up what id your textbox is being assigned in client. If that textbox is part of a web user control or inside a datagrid or something, its client id won't be the same as the server id. you can also add that javascript code in a function in your aspx file, and simply call it on the body's onload event. I'm sure there are better ways, I'd be glad to read them. daniero

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups