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. asp.net2.0

asp.net2.0

Scheduled Pinned Locked Moved ASP.NET
csharpasp-net
3 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.
  • R Offline
    R Offline
    ritu4321
    wrote on last edited by
    #1

    whenever i press enter key the form gets refresh ie postback occurs. How can this be avoided.

    N D 2 Replies Last reply
    0
    • R ritu4321

      whenever i press enter key the form gets refresh ie postback occurs. How can this be avoided.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Just in case you missed the posting above titled "How to get an answer to your question". Make note of item number 3. For those new to message boards please try to follow a few simple rules when posting your question. Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears. Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with. Keep the subject line brief, but descriptive. eg "File Serialization problem" Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can. If you are posting source code with your question, place it inside <pre></pre> tags, or click the "Ignore HTML tags in this message" check box. Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job. Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted. Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice. If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums. No advertising or soliciting. We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal. cheers, Chris Maunder CodeProject.com : C++ MVP To answer the question, use AJAX


      only two letters away from being an asset

      1 Reply Last reply
      0
      • R ritu4321

        whenever i press enter key the form gets refresh ie postback occurs. How can this be avoided.

        D Offline
        D Offline
        dojohansen
        wrote on last edited by
        #3

        There are many ways. One simple way is to add client-side script to handle "onsubmit" and cancel the event. This does not affect programmitcal form submission (ie. calls to form.submit) so asp.net controls still post back as normal, but simply having an INPUT inside the form will not lead to postback when pressing enter. In the "head" section, include the following script:

        attachEvent("onsubmit", function
        {
        event.cancelBubble = true; event.returnValue = false;
        });

        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