Solved

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

Posted on 2012-03-27
2
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
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)…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

717 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