Solved

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

Posted on 2012-03-27
2
179 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 40

Accepted Solution

by:
Kyle Abrahams earned 500 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now