public knowledge blog_load(sender Virendra)

                                                                                                                          Nothing shocks me, I am a Software Engineer.

Update Panel, Default Button and FireFox

Posted by Virendra Dugar on March 29, 2009

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.

Enjoy….

Advertisements

4 Responses to “Update Panel, Default Button and FireFox”

  1. ben said

    You are the genius, your UseSubmitBehavior=”False” solved my problem. Thanks brother.

  2. Tim said

    I have looked into the use submit behaviour and if the client has no JS enabled then your button will not postback.
    I would suggest looking at this article (C# Form DefaultButton Firefox fix/workaround) I wrote and this should point you in the right direction by setting a default button on the form and also how to get around the JS problem for FF and textareas.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: