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. Problem to submit an ASP.NET form by the ENTER KEY

Problem to submit an ASP.NET form by the ENTER KEY

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-nettutorialquestion
10 Posts 4 Posters 2 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
    TRAORE cheickna
    wrote on last edited by
    #1

    Hello, Into my asp.net application, i use a masterpage and many content pages. On my masterpage there is 3 asp.net imagebutton controls. in order to display a content page i click on one of this control which use Response.Redirect function. the problem i have is when i use a content page by typing for example informations like Name,email, password, i.e, then if i try to hit enter key to validate my values i am surprise to see that it's the code behind the fisrt image button on my master page wich is run. I have only one button on my content page and i don't understand why the EnterKey don't run the click envent os thif button? Thanks for any help

    J J 2 Replies Last reply
    0
    • T TRAORE cheickna

      Hello, Into my asp.net application, i use a masterpage and many content pages. On my masterpage there is 3 asp.net imagebutton controls. in order to display a content page i click on one of this control which use Response.Redirect function. the problem i have is when i use a content page by typing for example informations like Name,email, password, i.e, then if i try to hit enter key to validate my values i am surprise to see that it's the code behind the fisrt image button on my master page wich is run. I have only one button on my content page and i don't understand why the EnterKey don't run the click envent os thif button? Thanks for any help

      J Offline
      J Offline
      JacquesDP
      wrote on last edited by
      #2

      try using panels, put your fields inside a panel and set the DefaultButton for that panel

      .....your input fields and the button here.....
      

      No matter how long he who laughs last laughs, he who laughs first has a head start!

      T P 2 Replies Last reply
      0
      • J JacquesDP

        try using panels, put your fields inside a panel and set the DefaultButton for that panel

        .....your input fields and the button here.....
        

        No matter how long he who laughs last laughs, he who laughs first has a head start!

        T Offline
        T Offline
        TRAORE cheickna
        wrote on last edited by
        #3

        Hi, Thank's for your reply. Using panel work fine but i met a piece of problem. I have three Button controls on my aspx page whose one is defined as DefaultButton into my panel properties. In some cases this defaultButton is set to Visible=false and enable=false. Because the two others Button are not declared Default in the panel the same problem when i hit Enter Key occurs. Have you any others good suggestions for me? Thank's in advance

        J 1 Reply Last reply
        0
        • J JacquesDP

          try using panels, put your fields inside a panel and set the DefaultButton for that panel

          .....your input fields and the button here.....
          

          No matter how long he who laughs last laughs, he who laughs first has a head start!

          P Offline
          P Offline
          parthibandharma
          wrote on last edited by
          #4

          what is the use for panel. i need an explanation for panel... in asp.net

          J 1 Reply Last reply
          0
          • T TRAORE cheickna

            Hi, Thank's for your reply. Using panel work fine but i met a piece of problem. I have three Button controls on my aspx page whose one is defined as DefaultButton into my panel properties. In some cases this defaultButton is set to Visible=false and enable=false. Because the two others Button are not declared Default in the panel the same problem when i hit Enter Key occurs. Have you any others good suggestions for me? Thank's in advance

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

            I assume that you set the button visibility from the code behind on some sort of condition, so when you set the visibility for the button, change the default button for the panel as well.

            if(someCondition)
            {
            mainButton.Visible = false;
            pnlDetails.DefaultButton = "secondButton";
            ...
            ...
            }
            else
            {
            mainButton.Visible = true;
            pnlDetails.DefaultButton = "mainButton";
            ...
            ...
            }

            Hope this helps

            No matter how long he who laughs last laughs, he who laughs first has a head start!

            T 1 Reply Last reply
            0
            • P parthibandharma

              what is the use for panel. i need an explanation for panel... in asp.net

              J Offline
              J Offline
              JacquesDP
              wrote on last edited by
              #6

              Here you go MSDN[^]

              No matter how long he who laughs last laughs, he who laughs first has a head start!

              1 Reply Last reply
              0
              • J JacquesDP

                I assume that you set the button visibility from the code behind on some sort of condition, so when you set the visibility for the button, change the default button for the panel as well.

                if(someCondition)
                {
                mainButton.Visible = false;
                pnlDetails.DefaultButton = "secondButton";
                ...
                ...
                }
                else
                {
                mainButton.Visible = true;
                pnlDetails.DefaultButton = "mainButton";
                ...
                ...
                }

                Hope this helps

                No matter how long he who laughs last laughs, he who laughs first has a head start!

                T Offline
                T Offline
                TRAORE cheickna
                wrote on last edited by
                #7

                Thanks Jacques, Great, great, great! It was so simple. Merci beaucoup!!!

                J 1 Reply Last reply
                0
                • T TRAORE cheickna

                  Thanks Jacques, Great, great, great! It was so simple. Merci beaucoup!!!

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

                  it's my pleasure, glad I could help

                  No matter how long he who laughs last laughs, he who laughs first has a head start!

                  P 1 Reply Last reply
                  0
                  • T TRAORE cheickna

                    Hello, Into my asp.net application, i use a masterpage and many content pages. On my masterpage there is 3 asp.net imagebutton controls. in order to display a content page i click on one of this control which use Response.Redirect function. the problem i have is when i use a content page by typing for example informations like Name,email, password, i.e, then if i try to hit enter key to validate my values i am surprise to see that it's the code behind the fisrt image button on my master page wich is run. I have only one button on my content page and i don't understand why the EnterKey don't run the click envent os thif button? Thanks for any help

                    J Offline
                    J Offline
                    jkirkerx
                    wrote on last edited by
                    #9

                    You have to wrap the controls in a panel object, and assign a default button to the panel. Took me years to figure that out.

                    1 Reply Last reply
                    0
                    • J JacquesDP

                      it's my pleasure, glad I could help

                      No matter how long he who laughs last laughs, he who laughs first has a head start!

                      P Offline
                      P Offline
                      parthibandharma
                      wrote on last edited by
                      #10

                      The panel control has the viewstate property and div doesnt A Panel control requires more processing to generate HTML, while a

                      requires less.

                      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