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. Enter key and button behavior

Enter key and button behavior

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsysadminhelpquestion
6 Posts 4 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.
  • A Offline
    A Offline
    aecordoba
    wrote on last edited by
    #1

    Hi there! I have a WebForm (ASP.NET 2.0) with a textbox and two buttons, one of them (sendButton) to send the textbox's content, and the other one (cancelButton) to cancel the operation. I need when the user write something in the textbox and then press 'Enter' key, the textbox's content will be sent to the server. (The same thing like if he push the sendButton.) I have some WebForms with that behavior: 'Enter' key has the same effect like a button, but I don't see difference. Can somebody help me? Thank you in advance.

    [Adrián Córdoba]

    B Steve EcholsS 2 Replies Last reply
    0
    • A aecordoba

      Hi there! I have a WebForm (ASP.NET 2.0) with a textbox and two buttons, one of them (sendButton) to send the textbox's content, and the other one (cancelButton) to cancel the operation. I need when the user write something in the textbox and then press 'Enter' key, the textbox's content will be sent to the server. (The same thing like if he push the sendButton.) I have some WebForms with that behavior: 'Enter' key has the same effect like a button, but I don't see difference. Can somebody help me? Thank you in advance.

      [Adrián Córdoba]

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

      1 Reply Last reply
      0
      • A aecordoba

        Hi there! I have a WebForm (ASP.NET 2.0) with a textbox and two buttons, one of them (sendButton) to send the textbox's content, and the other one (cancelButton) to cancel the operation. I need when the user write something in the textbox and then press 'Enter' key, the textbox's content will be sent to the server. (The same thing like if he push the sendButton.) I have some WebForms with that behavior: 'Enter' key has the same effect like a button, but I don't see difference. Can somebody help me? Thank you in advance.

        [Adrián Córdoba]

        Steve EcholsS Offline
        Steve EcholsS Offline
        Steve Echols
        wrote on last edited by
        #3

        I think you can also use:

        If you're using master pages, you have to set the default button for each page manually like this (in you Page Load handler): HtmlForm frm = (HtmlForm)Master.FindControl("form1"); frm.DefaultButton = sendButton.UniqueID; Worth a shot anyway. - S 50 cups of coffee and you know it's on! A post a day, keeps the white coats away!

        • S
          50 cups of coffee and you know it's on!
          Code, follow, or get out of the way.
        B A 2 Replies Last reply
        0
        • Steve EcholsS Steve Echols

          I think you can also use:

          If you're using master pages, you have to set the default button for each page manually like this (in you Page Load handler): HtmlForm frm = (HtmlForm)Master.FindControl("form1"); frm.DefaultButton = sendButton.UniqueID; Worth a shot anyway. - S 50 cups of coffee and you know it's on! A post a day, keeps the white coats away!

          B Offline
          B Offline
          Baran M
          wrote on last edited by
          #4

          [http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/](http://kpumuk.info/asp-net/using-pane :) l-defaultbutton-property-with-linkbutton-control-in-asp-net/)[^] Plz find this link,it would be helpful for us.

          Steve EcholsS 1 Reply Last reply
          0
          • B Baran M

            [http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/](http://kpumuk.info/asp-net/using-pane :) l-defaultbutton-property-with-linkbutton-control-in-asp-net/)[^] Plz find this link,it would be helpful for us.

            Steve EcholsS Offline
            Steve EcholsS Offline
            Steve Echols
            wrote on last edited by
            #5

            Maybe post on main thread....


            - S 50 cups of coffee and you know it's on! A post a day, keeps the white coats away!

            • S
              50 cups of coffee and you know it's on!
              Code, follow, or get out of the way.
            1 Reply Last reply
            0
            • Steve EcholsS Steve Echols

              I think you can also use:

              If you're using master pages, you have to set the default button for each page manually like this (in you Page Load handler): HtmlForm frm = (HtmlForm)Master.FindControl("form1"); frm.DefaultButton = sendButton.UniqueID; Worth a shot anyway. - S 50 cups of coffee and you know it's on! A post a day, keeps the white coats away!

              A Offline
              A Offline
              aecordoba
              wrote on last edited by
              #6

              Steve Echols wrote:

              If you're using master pages, you have to set the default button for each page manually like this (in you Page Load handler): HtmlForm frm = (HtmlForm)Master.FindControl("form1"); frm.DefaultButton = sendButton.UniqueID;

              Thank you, 'S'. You are right.

              [Adrián Córdoba]

              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