UpdatePanel, Default Button and Firefox

Posted by Virendradugar under ASP.NET AJAX category on | Views : 4461
ASP.Net 2.0 comes up with a new concept called ?Default Button? which is one button on the form will work as default button. Whenever we press the enter button default button will be called.

As for example: In a text box after typing you press enter your default button?s event will be fired.

However, the one thing that was bothering me with the Default Button is it worked like a charm in IE. In Firefox, it behaved weirdly. The problem wasn?t that it didn?t do a postback. That it did. What it didn?t do was hit the server side event (the button click event).

When you are selected in any textbox and you press enter, IE will submit this and hit the button click even. However with FireFox, it will only submit ? not call the onclick event.

To solve this add: UseSubmitBehavior="False" to your submit button. Now you can press enter whenever you want in your form and it will do the proper submit regardless of IE or Firefox.


Comments or Responses

Posted by: Chinnu21 on: 9/14/2009 Level:Starter | Status: [Member]
You can do a simple thing have one more text box and make it visible false. and now your code will work for enter key.

Login to post response