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" />
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" />
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.
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