find a location for property in a new city

Monday, 14 January 2013

Web forms button click event not firing in IE

There are probably many reasons why a button would not fire in an ASP.NET web forms application. Some can be fixed with deleting cookies and history, some are to do with when the event is registered. I found a new one though.

In my scenario I had a text box that was submitted with a button next to it. We didn't want to display the button though but instead wanted the form submitted with a click of the Enter button. The button was therefore wrapped in a display:none span, like this:

<input type="text" id="txtInput" onchange="btnGo_Click" runat="server"/>
<asp:Button style="display:none;" runat="server" OnClick="btnGo_Click" />
<asp:Label ID="lblOutput" runat="server" />

It turns out that this worked just fine in Chrome and Firefox but not in IE9. This was because not all browsers post data that is hidden with CSS. Security possibly? You could see this by looking at the request in Fiddler. There was no value for the button field in IE but there was for the others.

How to submit a form by clicking Enter and hiding the button

The best way I can think of is to hide the button without hiding it... How? You can push it miles of the page to hide the button with some CSS like this:

<input type="text" id="txtInput" onchange="btnGo_Click" runat="server"/>
<asp:Button style="position:absolute;left:-9999px;" runat="server" OnClick="btnGo_Click" />
<asp:Label ID="lblOutput" runat="server" />

This will put the button miles off to the left never to be seen by the user.

Follow britishdev on Twitter

50 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I love to read this type of material Good and attractive information I take from it..Thank you for posting such a good article
    happy wheels ez
    super mario bros
    pacman
    agario

    ReplyDelete
  3. I really like this kind of post here. I want to share more post about that topic. keep it up. Grass mats from groundreinforcementmesh.co.uk from http://groundreinforcementmesh.co.uk/grass-mats.html

    ReplyDelete
  4. The blog is Really informative and looks realistic. I appreciate your style and surely come back again to increase my knowledge.Mostly comments to match to eatch other.I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got Garage Flooring

    ReplyDelete
  5. I have encountered this situation and very difficult to overcome it. Thank you for giving me helpful information
    signature:
    head soccer - Big Head Soccer - head soccer - Big Head Soccer - Tiny Tanks - Tiny Planes

    ReplyDelete
  6. This blog is so nice to me. I will continue to come here again and again. Visit my link as well. Good luck
    obat aborsi
    cara menggugurkan kandungan

    ReplyDelete
  7. Our associates are the qualified agencies that can tackle shifting
    and take it to the next stage of succession.
    Relocation Services in Bangalore
    Moving Organization in Hyderabad
    Packing and Moving Services in Thane
    http://bestpackers.org/

    ReplyDelete
  8. Companies particular with us carry all kind of shifting successfully.
    Ask definitely without any price shifting views and deal with your Moving
    price extensive variety accordingly.
    Shifting and Moving in Gurgaon
    Household Moving in Delhi
    Professional Packers and Movers in Noida

    ReplyDelete
  9. Packers and movers of India have a well qualified staff to deal
    with home items with careful attention while caring it to automobile,
    during transportation and when unloading happens, shifting alternatives etc.
    Packing and Moving in Pune
    Packer and Mover Mumbai
    Reliable Packing Services in Navi Mumbai

    ReplyDelete
  10. Packers and Movers India have exceptionally delineated vehicles which
    have bounteous and adequate recognize to keep your stock. They are staggering
    properly secured vehicles along these lines keep items from outside unsettling impact.
    Safe Packaging and Moving in Chennai
    Secure Move in Faridabad
    Get Best Movers in Ghaziabad

    ReplyDelete
  11. a given article is very interesting and very useful for me, thank you very much admin and pardon me

    permission to share the article here :

    Obat

    ginjal bocor

    Obat radang usus
    Obat gondok

    ReplyDelete
  12. I'm looking for a few bugs in my post. But I think I should have someone look and point out it.
    http://colorswitchplay.com

    ReplyDelete
  13. I was very impressed by this post, this site has always been pleasant news. Thank you very much for such an interesting post. Keep working, great job! In my free time, I like play game: superfighters2.net. What about you?

    ReplyDelete
  14. Obat Penggugur kandungan,,, Nice bag you can earn money from that
    Thanks for your posting
    Visit me @, Obat Aborsi,,
    Jual Obat Aborsi,,,

    Harga Obat Aborsi,,,

    ReplyDelete
  15. The article you have shared here very awesome. I really like and appreciated your work. I read deeply your article, the points you have mentioned in this article are useful.
    iogamez.com
    Geometrydashonline.net

    ReplyDelete
  16. This article is really good. It has solved one of queries in my mind. thanks. for any accounting related help you can visit -Hybrid Accounting

    ReplyDelete
  17. Love it! Very interesting topics, I hope the incoming comments and suggestion are equally positive. Thank you for sharing this information that is actually helpful.


    Hybrid Accounting
    Accounting Services in indianapolis
    bookkeeping services in indianapolis
    payroll services in indianapolis

    ReplyDelete
  18. This is only the data I am discovering all over. A debt of gratitude is in order for your website, I simply subscribe your online journal. This is a decent blog.. jual tv stand

    ReplyDelete
  19. Im going to examine this. unwell be stubborn abet on lower back occurring. thanks for sharing. and with this text gives the mild wherein we will observe the realism. that is selected manageable one and gives indepth safety. thanks for this handy article... click here

    ReplyDelete
  20. What could fill somebody's heart with joy other than perusing such delightfully made blog, for example, this.
    Mason Soiza

    ReplyDelete
  21. This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself..
    Mason Soiza

    ReplyDelete
  22. New web design businesses are springing up all of the moment, but don't be tricked by shiny sites loudly proclaiming their amazing services.maketavimo paslaugos

    ReplyDelete
  23. During this stage the web designer will most likely participate to make sure that his design works with the customers requirements. Indeed, the requirements will most likely include details about how the customer wants the web site to appear.
    https://medijo.lt/skrajutes/

    ReplyDelete
  24. Packers And Movers Bangalore Local Household Shifting Service, Get Free Best Price Quotes Local Packers and Movers in Bangalore List , Compare Charges, Save Money And Time @ Packers And Movers in Bangalore

    ReplyDelete
  25. Packers and Movers Gurgaon Provide Reliable, Safe and Certified Service Provider list, Get Free ***Best Price Quotaition and Compare Charges. ✔✔✔ Hassle free Household Shifting Services, High Quality packing Material, Office Relocation, Car Transportaion, ###Local and Domestic Shifting Service @
    Packers And Movers Gurgaon

    ReplyDelete
  26. Packers and Movers in Rewari -Air Cargo Packers and Movers in Rewari are best Movers and Packers in Rewari and all the important locations in Ncr at reasonable price. Packers and Movers in Rewari gift you best deals of knowledgeable about Ncr. Packers and Movers in Rewari have a tendency to providing quality service at competitive world from prime rated Packers. You are moving down the road with Rewari or moving from this town to in other places. Packers and Movers in Delhi are able to offer you the best match for your move.

    ReplyDelete
  27. Packers and Movers in Delhi -Air wares Packers and Movers could be a metropolis primarily based Packers Movers Company providing reliable and cost-efficient Packers Movers services, Packers and Movers in metropolis and Packing Moving services all told over Republic of India. it's branches all told the most cities of Republic of India. Packers and Movers in metropolis worth the emotions of our customers and thence take that any care, whereas moving and packaging the merchandise of our customers.

    ReplyDelete
  28. Packers and Movers in Greater Noida - We give vast importance to loading and unloading, because it is at this stage that damage to goods frequently occurs.

    ReplyDelete
  29. Packers and Movers Pune Provide High Quality ***Household Shifting, Home/Office Relocation, Insurance, Packing, Loading, ###Car Transportation Service Pune and High experiences, Top Rated, Safe and Reliable, Best and Secure Packers and Movers Pune Team List. Get ✔✔✔ Affordable Rate Charts and Compare Quotation and Save Money and Time .
    Packers And Movers Pune

    ReplyDelete
  30. Packers and Movers Hyderabad Give Certified and Verified Service Providers, Cheap and Best ###Office Relocation Charges, ***Home Shifting, ???Goods Insurance worth Rs. 10,000, Assurance for Local and Domestic House Shifting. Safe and Reliable Household Shifting Services in Hyderabad with Reasonable Packers and Movers Price Quotation @
    Packers And Movers Hyderabad

    ReplyDelete
  31. Hire Best Packers And Movers Mumbai for hassle-free Household Shifting, ***Office Relocation, ###Car Transporation, Loading Unloading, packing Unpacking at affordable ✔✔✔ Price Quotation. Top Rated, Safe and Secure Service Providers who can help you with 24x7 and make sure a Untroubled Relocation Services at Cheapest/Lowest Rate
    Packers And Movers Mumbai

    ReplyDelete
  32. Motifz Designer Lawn. 1, 2 & 3 Piece Unstitched Premium Embroidered Lawn 2019, Premium Lawn, Lawn 2019, Best lawn collection, Motifz, Best Lawn in Pakistan, Shipping worldwide. Stitching option available.

    ReplyDelete
  33. Buy Premium lawn Online for Women's at best prices available at Motifz. ✓ Latest Fashion, ✓ Trendy Designs ➤ Shop Now!

    ReplyDelete
  34. Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it's quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards, Find out more

    ReplyDelete
  35. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. Webdesign

    ReplyDelete
  36. Nice to read your article! I am looking forward to sharing your adventures and experiences. Webdesign

    ReplyDelete
  37. I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! Webdesign

    ReplyDelete
  38. Webdesigner waar u een professionele en betaalbare website kan laten maken? De nr. 1 webdesigner in Limburg, Antwerpen en Vlaams-Brabant voor SEO websites. Webdesigner

    ReplyDelete
  39. Be that as it may, learning is just the starting now you need to make a portfolio, and search for work. Webdesign

    ReplyDelete
  40. I have been looking to discover a solace or powerful Best ps4 steering to finish this procedure and I think this is the most reasonable approach to do it viably.Click Here

    ReplyDelete
  41. I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. Webdesign bureau

    ReplyDelete