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
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to set focus on a textbox at specific index

how to set focus on a textbox at specific index

Scheduled Pinned Locked Moved ASP.NET
databasetutoriallounge
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.
  • N Offline
    N Offline
    NetMan2012
    wrote on last edited by
    #1

    HI, I have a database driven chat room which refreshes after every 10 sec. If the user is typing some thing on the chat box teh page refreshes and focus is set to the start of chat textbox. i want to set the focus on teh right where the user is currently typoing e.g if page refreshes and he has already typed Hell, then focus should be after l, not from start. Thanks in advance..

    P J 2 Replies Last reply
    0
    • N NetMan2012

      HI, I have a database driven chat room which refreshes after every 10 sec. If the user is typing some thing on the chat box teh page refreshes and focus is set to the start of chat textbox. i want to set the focus on teh right where the user is currently typoing e.g if page refreshes and he has already typed Hell, then focus should be after l, not from start. Thanks in advance..

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      The standard technique for doing this is actually quite different. When you perform your refresh, you don't actually refresh everything on the page - what you do, instead, is refresh only certain parts of the screen. Using AJAX you retrieve the data you need and then you update the small areas of the screen that have changed. This leaves the textbox untouched, and the user can carry on without having focus flash around on them.

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

      1 Reply Last reply
      0
      • N NetMan2012

        HI, I have a database driven chat room which refreshes after every 10 sec. If the user is typing some thing on the chat box teh page refreshes and focus is set to the start of chat textbox. i want to set the focus on teh right where the user is currently typoing e.g if page refreshes and he has already typed Hell, then focus should be after l, not from start. Thanks in advance..

        J Offline
        J Offline
        javadhelali
        wrote on last edited by
        #3

        the best method to implement your application is not to postback page in every 10sec ... you'd better use ajax calls ... but if you want to do it after postback you shoud produce some scripts (javascript) code dynamically to focus on the previous control that user was using ...

        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