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 remove focus from a button.

How to remove focus from a button.

Scheduled Pinned Locked Moved ASP.NET
javascripthelptutorial
4 Posts 2 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.
  • T Offline
    T Offline
    thomasa
    wrote on last edited by
    #1

    Hey. I have a search page containg 2 buttons and 2 textboxes. I have a javascript that cathces the enter-key event and triggers the respecting button, as in TextBox1 to Button1 and TextBox2 to Button2. My problem is that when I enter the page, the Button2 is allways in focus, no mather if I have the TextBox1 in focus or click on a CheckBox that is allsow have on the page. So when I hit the enter-key, the Button2.click event is allways triggerd. Does anyone know how to get around this. Thanks Thomas

    T P 3 Replies Last reply
    0
    • T thomasa

      Hey. I have a search page containg 2 buttons and 2 textboxes. I have a javascript that cathces the enter-key event and triggers the respecting button, as in TextBox1 to Button1 and TextBox2 to Button2. My problem is that when I enter the page, the Button2 is allways in focus, no mather if I have the TextBox1 in focus or click on a CheckBox that is allsow have on the page. So when I hit the enter-key, the Button2.click event is allways triggerd. Does anyone know how to get around this. Thanks Thomas

      T Offline
      T Offline
      thomasa
      wrote on last edited by
      #2

      I had to replace the Buttons with LinkButtons

      1 Reply Last reply
      0
      • T thomasa

        Hey. I have a search page containg 2 buttons and 2 textboxes. I have a javascript that cathces the enter-key event and triggers the respecting button, as in TextBox1 to Button1 and TextBox2 to Button2. My problem is that when I enter the page, the Button2 is allways in focus, no mather if I have the TextBox1 in focus or click on a CheckBox that is allsow have on the page. So when I hit the enter-key, the Button2.click event is allways triggerd. Does anyone know how to get around this. Thanks Thomas

        P Offline
        P Offline
        puviyarasan j
        wrote on last edited by
        #3

        set UseSubmitBehavior = true in Button property

        1 Reply Last reply
        0
        • T thomasa

          Hey. I have a search page containg 2 buttons and 2 textboxes. I have a javascript that cathces the enter-key event and triggers the respecting button, as in TextBox1 to Button1 and TextBox2 to Button2. My problem is that when I enter the page, the Button2 is allways in focus, no mather if I have the TextBox1 in focus or click on a CheckBox that is allsow have on the page. So when I hit the enter-key, the Button2.click event is allways triggerd. Does anyone know how to get around this. Thanks Thomas

          P Offline
          P Offline
          puviyarasan j
          wrote on last edited by
          #4

          set UseSubmitBehavior=True in Button property

          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