?
Solved

Hiting  Enter button causes cancel button to fire..,but i want Search button to be fired..

Posted on 2012-03-27
2
Medium Priority
?
187 Views
Last Modified: 2012-08-13
I have two button in Webpage
            <td class="buttonCell" " colspan="5" >      
                              <asp:button id="btnClear" CssClass="button" Text="Clear All" Runat="server"      Width="75px" OnClick="btnClear_Click" CausesValidation="False"></asp:button>
                      <asp:button id="btnSearch" CssClass="defaultbutton" Text="Search" Runat="server" Width="75px" OnClick="btnSearch_Click" AccessKey="S" CausesValidation="False"></asp:button>          
        </td>


In master page i have this jquery
   jQuery(document).keydown(function (event) {
              if (event.keyCode == 13) {
                  //not working: alert("Enter clicked.");
                  //not working: __doPostBack('__Page', 'EnteryKey');
                  //find default button.
                  var submitButton = jQuery(".defaultbutton").get(0);
                  if (submitButton != null) {
                      submitButton.click();
                  }
              }

When i hit enter button it trigger Cancel_clik event ,not search_click.
If i change the order it works find .Due to some CSS and layout issues ,i dont want to change the order.
Can any one help me .
0
Comment
Question by:hariaspind
2 Comments
 
LVL 41

Accepted Solution

by:
Kyle Abrahams earned 1500 total points
ID: 37773309
http://forums.asp.net/t/985791.aspx/1

In your form set the default button.
0
 

Author Closing Comment

by:hariaspind
ID: 37773759
It worked for me .Thanks.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question