Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 176861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:57:09+00:00 2026-05-11T13:57:09+00:00

I have been playing around with a search control and i have noticed that

  • 0

I have been playing around with a search control and i have noticed that when you try and press enter from within the textbox it submits the form but doesnt click the search button (like i want it to).

My markup is:

<div>     <span>Search</span>     <asp:TextBox ID='txtSearch' runat='server' Width='170'         onkeydown='if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {$('#<%=lkbSearch.ClientID %>').click();return false;} else return true; '>     </asp:TextBox> </div> <asp:LinkButton ID='lkbSearch' runat='server' CssClass='searchButton'>     <asp:Image ID='imgSearch' runat='server' ImageUrl='~/Images/Master/button_go.gif' /> </asp:LinkButton> 

i added the onkeydown event to the textboxes, and it runs, but when i try to use JQuery to call the Click() function from the button it does nothing.

How can i make it so when enter is pressed in the textbox it ‘clicks’ the button?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:57:10+00:00Added an answer on May 11, 2026 at 1:57 pm

    After playing around with a few different things i finally came up with the solution.

    I wrapped the textbox and button in an asp:panel control and set the default button to the ID of my LinkButton only to find that panels cant have LinkButtons as the DefaultButton.

    But changing the link button to an ImageButton and using its ID in the DefaultButton filed of the panel works perfectly.

    <asp:Panel ID='pnlSearch' runat='server' DefaultButton='imbSearch'> ... </asp:Panel> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been playing around a bit with a fairly simple, home-made search engine,
I have been playing around with creation of pdf documents for a project that
I have been playing around with some debugging and wrote some C code that
I have been playing around with node.js, and coming from a Java background, I
I have been playing around with haskell and I found out that if I
I have been playing around with the WPF GridView control (DesktopUI not Silverlight) and
I have been playing around with different scripts, I found one that works for
I have been playing around with Google Apps Script today and I am trying
I have been playing around with the MVP pattern using winforms for the last
I have been playing around with the Rhino ETL library and really like the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.