Home » Microsoft, Tutorials

Enter Not Working in IE

20 December 2009 View Comments By Nitin Kumar Jain
Tags: , , , , ,
Share




Recently, I noticed a weird thing when one of my aspx page did not post back the command button click event when <enter> on the keyboard was hit having focus on a textbox.

Actually, I have an aspx page in my Dot Net project and it has only 2 controls on it. One is textbox and another one is submit button to search the content.

The HTML code of the page looks like:

<asp:TextBox ID="a"  runat="server"/>
<asp:Button ID="test"  PostBackUrl="Default.aspx?CMD=Add" Text="Add" runat="server"/>

(I have skipped the html and other common tags for easy reading.)

Now, ideally, when the user keys in some value in the textbox and hit <enter> on the keyboard then the submit button click should be executed, but it does not. Though the page is posted back but nothing happens.

Strange thing is that the problem occurs only when there is a single textbox control on the page. If I add another textbox on the page then it works like a butter.

<asp:TextBox ID="a"  runat="server"/>
<asp:TextBox ID="b"  runat="server"/>
<asp:Button ID="test"  PostBackUrl="Default.aspx?CMD=Add" Text="Add" runat="server"/>

I am running .Net framework 2.0 and VS2005.

After googling it for a while, I discovered that it is not a problem with Dot Net framework or studio but a known problem with browser IE.

Basically, IE doesn’t send the name/value pair on postback when only one textbox exists. However, it does for >1 textboxes.

So, to make it run we can add a hidden textbox as a workaround and it works good then. Read an article on 4GuysFromRolla.

Strange but true. Known bug but nothing has been done to fix it yet.


Related posts:

  1. Add Alexa Traffic Rank Button in 4 Steps If you wish to add Alexa Traffic Rank Button on...
  2. Microsoft’s Calculator Failed Can you imagine Microsoft’s Calculator can also fail in some...
  3. Label and Refer Diagrams, Tables in MS Word The preferred approach for labelling and referencing  ’screen shots’, diagrams,...
  4. Recharge your Mobile / DTH Online Now you can recharge your mobile (any provider) and DTH...
  5. Get WordPress 2.8 Beta1 WordPress has released 2.8 Beta 1. It has some attractive...
  6. How to Remove Listings from Add/Remove Programs If any application happens to have left out in the...
  7. Ajax Usage Among .NET Developers in 2009 Code Climber has survey to see what is happening in...
  8. Select Active Item in Solution Explorer If you work on Microsoft dot net technologies and use...
  9. Facebook Like Button Giving Error Facebook recently released Like button for websites / blogs and...
  10. Know Your Numerology Prediction If you believe in Numerology and have been searching for...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

blog comments powered by Disqus