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 741473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:38:10+00:00 2026-05-14T08:38:10+00:00

Basically I have an asp.net website with login and search pages. Currently, I have

  • 0

Basically I have an asp.net website with login and search pages.

Currently, I have no idea why, when ever a user hits enter in either of the login text boxes (user name/password) or in the Seach text box, the website is redirected to the default page.

I have no idea why this is happening, I’ve tried setting defaultButton on both the panel containing the search and the login panel but that doesnt seem to work.

I’ve also tried catching the key press event with javascript which isnt working either.

I have no idea what event is being fired and why, or why it seems to override everything I try to do.

Anyone seen anything like this before?

—————Edit——————-

 <div class="searchBar" onkeypress="javascript:return
  WebForm_FireDefaultButton(event,'ctl00_MainContent_logView1_LogRepeater_ctl02_lbSearch')">

  <input name="ctl00$MainContent$logView1$LogRepeater$ctl02$ctl02" type="text" />
  <a id="ctl00_MainContent_logView1_LogRepeater_ctl02_lbSearch" href="javascript:__doPostBack('ctl00$MainContent$logView1$LogRepeater$ctl02$lbSearch','')">
  Search</a>
 </div>

Ok so here is the code generated by ASP.net that is getting ignored.

—————Update—————-

I have tried adding a hidden button and setting that button as the defaultbutton of the form and that has stoped it from redirecting to the default page each time but this does mean that pressing enter in a text box just reloads the page, which is better but still isnt Ideal.

  • 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. Editorial Team
    Editorial Team
    2026-05-14T08:38:10+00:00Added an answer on May 14, 2026 at 8:38 am

    This may not be an ASP.NET quirk as much as it is a web-browser quirk.

    When you press enter in a single-line text field, the browser will submit the form to the action specified in the form tag.

    ASP.NET “helpfully” creates a form tag just inside the body tag and puts all body elements inside it…

    As far as I know, you can safely remove this form tag; the HTML specification allows fields outside of form tags for use in JavaScript/AJAX operations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have an asp.net website that we use to generate html emails. Basically
I have an ASP.NET website and from one of the web pages I need
I'm currently developing an ASP.NET website, and I'm using ASP.NET's built-in Login control with
I've created a website using ASP.net and C#. It's basically where students can login
This is what I'm talking about: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ComboBox/ComboBox.aspx basically I want to have a drop
Basically, we have an ASP website right now that I'm converting to PHP. We're
I have an ASP.NET website, on the masterpage I have a basic navigation menu:
I have built an ASP.NET MVC 3 web application (with exlusively Razor/cshtml pages) that
On a busy ASP .NET website, I have a Dictionary, which acts as a
I have a standard ASP.NET 2.0 website. It has a webpage page. I have

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.