0

On a webpage there is a text box and a button. when enter is pressed it activates the button1_click - how can I stop this?

 <asp:Button ID="Button1" runat="server"   Text = "ADD" 
            onclick="Button1_Click" />
nadG
  • 167
  • 1
  • 7
  • 17
  • You can refer [here](http://stackoverflow.com/questions/1561400/how-to-disable-submit-behaviour-of-aspimagebutton) for an answer to your question. – Thanassis_K Aug 07 '13 at 13:04

2 Answers2

2

You can do it in JQuery, it's very simple

$("form").submit(function(e){
        e.preventDefault();
    });

You have to add this in documentready and you are good to go.

Nipun Ambastha
  • 2,553
  • 1
  • 16
  • 26
0

You can use the UseSubmitBehavior property of the button: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.usesubmitbehavior%28v=vs.110%29.aspx

Paritosh
  • 4,243
  • 7
  • 47
  • 80