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. i want the code to run a procudere when enter key is pressed in asp.net apllication (help plz)

i want the code to run a procudere when enter key is pressed in asp.net apllication (help plz)

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelp
9 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.
  • J Offline
    J Offline
    jagan123
    wrote on last edited by
    #1

    i want the code to run a procudere when enter key is pressed in asp.net apllication .the key event should happen when i press the enter key in textbox.

    S M 2 Replies Last reply
    0
    • J jagan123

      i want the code to run a procudere when enter key is pressed in asp.net apllication .the key event should happen when i press the enter key in textbox.

      S Offline
      S Offline
      Sarani Ravindran
      wrote on last edited by
      #2

      Use Javascript function and call it on the server side. TextBox1.Attributes.Add("onkeypress","CheckKeyCode();") Validate the key as: function CheckKeyCode() { if(event.keyCode == 13) { return true; } else { return false; } } God is always with you.

      1 Reply Last reply
      0
      • J jagan123

        i want the code to run a procudere when enter key is pressed in asp.net apllication .the key event should happen when i press the enter key in textbox.

        M Offline
        M Offline
        Michael Sync
        wrote on last edited by
        #3

        jagadeeshkumar2106 wrote:

        i want the code to run a procudere

        this procedure is written in Javascript? if yes, chk the example below.. Example. function fireFunc() { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { **yourprocedure();** } } <input type="text" value="Check Answer" onkeypress="fireFunc()" >

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

        M J 2 Replies Last reply
        0
        • M Michael Sync

          jagadeeshkumar2106 wrote:

          i want the code to run a procudere

          this procedure is written in Javascript? if yes, chk the example below.. Example. function fireFunc() { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { **yourprocedure();** } } <input type="text" value="Check Answer" onkeypress="fireFunc()" >

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          sorry. i didn't see Saranya Devi's post.

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

          1 Reply Last reply
          0
          • M Michael Sync

            jagadeeshkumar2106 wrote:

            i want the code to run a procudere

            this procedure is written in Javascript? if yes, chk the example below.. Example. function fireFunc() { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { **yourprocedure();** } } <input type="text" value="Check Answer" onkeypress="fireFunc()" >

            Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

            J Offline
            J Offline
            jagan123
            wrote on last edited by
            #5

            sir the procedure is in code behind and it should call in javascript

            S M 2 Replies Last reply
            0
            • J jagan123

              sir the procedure is in code behind and it should call in javascript

              S Offline
              S Offline
              Sarani Ravindran
              wrote on last edited by
              #6

              Call your procedure like this: function getProcedure() { var obj obj=document.getElementById("button2") button2.click(); } "severside_handler" is the codebehind function that hander the button's server click event. God is always with you.

              J 1 Reply Last reply
              0
              • J jagan123

                sir the procedure is in code behind and it should call in javascript

                M Offline
                M Offline
                Michael Sync
                wrote on last edited by
                #7

                i posted the answer in your new post..

                Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

                1 Reply Last reply
                0
                • S Sarani Ravindran

                  Call your procedure like this: function getProcedure() { var obj obj=document.getElementById("button2") button2.click(); } "severside_handler" is the codebehind function that hander the button's server click event. God is always with you.

                  J Offline
                  J Offline
                  jagan123
                  wrote on last edited by
                  #8

                  var obj obj=document.getElementById("btngetdata"); obj.click(); i wrote like this and i kept two alerts before and after .but iam getting the two messages in the alert but iam not getting the this obj.click.

                  S 1 Reply Last reply
                  0
                  • J jagan123

                    var obj obj=document.getElementById("btngetdata"); obj.click(); i wrote like this and i kept two alerts before and after .but iam getting the two messages in the alert but iam not getting the this obj.click.

                    S Offline
                    S Offline
                    Sarani Ravindran
                    wrote on last edited by
                    #9

                    Try btngetdata.click(); God is always with you.

                    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