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. Enterkey of keyboard issues

Enterkey of keyboard issues

Scheduled Pinned Locked Moved ASP.NET
javascripttutorial
19 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.
  • S Sandeep Mewara

    Looks like your page is having a default button specified. Thus on click of it, that defualt button event is called. Either remove the default button of the page. If you are not setting it or unable to find one the try this: Use a dummy button in your page and set that button as Default button. Don't attach any handler to it(write reutrn false; in button's OnClientClick) and set the display style or visibility to false.

    C Offline
    C Offline
    Ch Gayatri Subudhi
    wrote on last edited by
    #5

    But in my whole application i used default button in log in page...but where in other page its redirecting to other.while clicking enter button of keyboard.but i did not sued ant default button to ant other pages accept login page

    S 1 Reply Last reply
    0
    • A Abhijit Jana

      Ch.Gayatri Subudhi wrote:

      .whn i m going a particular aspx page and thn click the enter button of keyboard the page is redirecting to another

      I guess, on that page there are some default control has been set, and which used to redirect you page to another page. As this is the default control and also Focused, so when some one Press Enter Enter key, it is redirecting to another page. As you don't want to use JavaScript, You can cange the default control of that page. Or focus any control which is not redirecting to any page. Hope you got my point. Please let me know if you need any help.

      Cheers ! Abhijit Codeproject MVP

      C Offline
      C Offline
      Ch Gayatri Subudhi
      wrote on last edited by
      #6

      Sir even though i used javascrip where in my app i used masterpage...still its not working

      A 1 Reply Last reply
      0
      • A Abhijit Jana

        Ch.Gayatri Subudhi wrote:

        .whn i m going a particular aspx page and thn click the enter button of keyboard the page is redirecting to another

        I guess, on that page there are some default control has been set, and which used to redirect you page to another page. As this is the default control and also Focused, so when some one Press Enter Enter key, it is redirecting to another page. As you don't want to use JavaScript, You can cange the default control of that page. Or focus any control which is not redirecting to any page. Hope you got my point. Please let me know if you need any help.

        Cheers ! Abhijit Codeproject MVP

        C Offline
        C Offline
        Ch Gayatri Subudhi
        wrote on last edited by
        #7

        sir..wht is other way to stop this issue.

        1 Reply Last reply
        0
        • C Ch Gayatri Subudhi

          But in my whole application i used default button in log in page...but where in other page its redirecting to other.while clicking enter button of keyboard.

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #8

          Ch.Gayatri Subudhi wrote:

          But in my whole application i used default button in log in page...but where in other page its redirecting to other.

          What does it mean? I didn't get your point. :confused: As I already suggested, if Default button is not necessary, you can create one blank control (may be textbox),hide it and focus it on page load. :)

          Cheers ! Abhijit Codeproject MVP

          1 Reply Last reply
          0
          • C Ch Gayatri Subudhi

            Sir even though i used javascrip where in my app i used masterpage...still its not working

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #9

            Ch.Gayatri Subudhi wrote:

            Sir even though i used javascrip where in my app i used masterpage...still its not working

            What you have done with javascript ? Can you please show us the code ?

            Cheers ! Abhijit Codeproject MVP

            C 1 Reply Last reply
            0
            • C Ch Gayatri Subudhi

              But in my whole application i used default button in log in page...but where in other page its redirecting to other.while clicking enter button of keyboard.but i did not sued ant default button to ant other pages accept login page

              S Offline
              S Offline
              Sandeep Mewara
              wrote on last edited by
              #10

              looks like you set your Default Button in MasterPage. is that so? that can only carry this to all other pages though you intend to use it in Login page only. Try putting the default button thing in Login Content page.

              C 1 Reply Last reply
              0
              • A Abhijit Jana

                Ch.Gayatri Subudhi wrote:

                Sir even though i used javascrip where in my app i used masterpage...still its not working

                What you have done with javascript ? Can you please show us the code ?

                Cheers ! Abhijit Codeproject MVP

                C Offline
                C Offline
                Ch Gayatri Subudhi
                wrote on last edited by
                #11

                <pre><body OnKeyPress="return disableKeyPress(event)"></pre>
                like this i wrote in masterpage</x-turndown>

                1 Reply Last reply
                0
                • S Sandeep Mewara

                  looks like you set your Default Button in MasterPage. is that so? that can only carry this to all other pages though you intend to use it in Login page only. Try putting the default button thing in Login Content page.

                  C Offline
                  C Offline
                  Ch Gayatri Subudhi
                  wrote on last edited by
                  #12

                  but in my login page it wont hv masterpage...rest of pages i used master page...

                  1 Reply Last reply
                  0
                  • C Ch Gayatri Subudhi

                    Hi.. In my project while i m running the application...whn i m going a particular aspx page and thn click the enter button of keyboard the page is redirecting to another how to stop this without javascript.I need code for this. Thanks in advance. With regards. Ch.Gayatri

                    A Offline
                    A Offline
                    Arindam Tewary
                    wrote on last edited by
                    #13

                    I would provide some input. Please check whether it actually helps in your scenario. if you are in "Page.aspx" where on keyboard "enter button" hit takes you to "Wrong.aspx". But you actually want to visit "Right.aspx". Please do following steps, Step 1. In Page.apsx, put "method" and "action" attribute in

                    tag as mentioned here

                    Step 2. in @Page directive in Page.aspx, add "EnableViewStateMac" attribute as the following if not already added

                    EnableViewStateMac="false"

                    Step 3. In @page directive in "Right.aspx" as set EnableViewStateMac = false. Now hitting "enter button" from keyboard while you are in Page.aspx, will always nagivate you to "Right.aspx" instead of "Wrong.aspx". Please let me know if it helps you.

                    Thanks, Arindam D Tewary

                    C 1 Reply Last reply
                    0
                    • A Arindam Tewary

                      I would provide some input. Please check whether it actually helps in your scenario. if you are in "Page.aspx" where on keyboard "enter button" hit takes you to "Wrong.aspx". But you actually want to visit "Right.aspx". Please do following steps, Step 1. In Page.apsx, put "method" and "action" attribute in

                      tag as mentioned here

                      Step 2. in @Page directive in Page.aspx, add "EnableViewStateMac" attribute as the following if not already added

                      EnableViewStateMac="false"

                      Step 3. In @page directive in "Right.aspx" as set EnableViewStateMac = false. Now hitting "enter button" from keyboard while you are in Page.aspx, will always nagivate you to "Right.aspx" instead of "Wrong.aspx". Please let me know if it helps you.

                      Thanks, Arindam D Tewary

                      C Offline
                      C Offline
                      Ch Gayatri Subudhi
                      wrote on last edited by
                      #14

                      while i m running my app...the flow is okay...but whn i clicked the enter button of keyboard i want to stop that action...becoz of that its redirect to anthor page...i need to stay the same page...even i m using masterpage

                      A 1 Reply Last reply
                      0
                      • C Ch Gayatri Subudhi

                        while i m running my app...the flow is okay...but whn i clicked the enter button of keyboard i want to stop that action...becoz of that its redirect to anthor page...i need to stay the same page...even i m using masterpage

                        A Offline
                        A Offline
                        Arindam Tewary
                        wrote on last edited by
                        #15

                        Ch.Gayatri Subudhi wrote:

                        but whn i clicked the enter button of keyboard i want to stop that

                        Did you mean from clicking mouse things are working but you want to stop doing any thing from "keyboard enter button" hit?

                        Thanks, Arindam D Tewary

                        C 1 Reply Last reply
                        0
                        • A Arindam Tewary

                          Ch.Gayatri Subudhi wrote:

                          but whn i clicked the enter button of keyboard i want to stop that

                          Did you mean from clicking mouse things are working but you want to stop doing any thing from "keyboard enter button" hit?

                          Thanks, Arindam D Tewary

                          C Offline
                          C Offline
                          Ch Gayatri Subudhi
                          wrote on last edited by
                          #16

                          yes sir..how to stop that

                          A 1 Reply Last reply
                          0
                          • C Ch Gayatri Subudhi

                            yes sir..how to stop that

                            A Offline
                            A Offline
                            Arindam Tewary
                            wrote on last edited by
                            #17

                            Put this code in your button's onkeypressevent

                            onkeypress="return eval((event.keyCode==13)?false:true);"

                            Post back hiting "enter" from keyboard would be stopped but from mouse click flow would be as it is. Please let me know if it helps.

                            Thanks, Arindam D Tewary

                            C 1 Reply Last reply
                            0
                            • A Arindam Tewary

                              Put this code in your button's onkeypressevent

                              onkeypress="return eval((event.keyCode==13)?false:true);"

                              Post back hiting "enter" from keyboard would be stopped but from mouse click flow would be as it is. Please let me know if it helps.

                              Thanks, Arindam D Tewary

                              C Offline
                              C Offline
                              Ch Gayatri Subudhi
                              wrote on last edited by
                              #18

                              Thanks a lot sir..now its working f9..

                              A 1 Reply Last reply
                              0
                              • C Ch Gayatri Subudhi

                                Thanks a lot sir..now its working f9..

                                A Offline
                                A Offline
                                Arindam Tewary
                                wrote on last edited by
                                #19

                                You are welcome !!! :-D

                                Thanks, Arindam D Tewary

                                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