Benefit of using UseSubmitBehavior in asp.net button Benefit of using UseSubmitBehavior in asp.net button asp.net asp.net

Benefit of using UseSubmitBehavior in asp.net button


It's lighter and less complicated. Without the behavior it's an onclick call to postback through JavaScript...but this is actually harder to deal with on the client when you want your own JavaScript.

For example if I'm adding an onsubmit handler to the <form> this is much easier/more straightforward when the natural <form> submit behavior from a type="submit" button is happening, it's also easier with any JS library, tying in your functions in the right order (when not set server-side, when it renders) is much easier when there is no client-side onclick interfering.

You can tie into event bubbling, the onsubmit, set onclick events yourself to prevent any default behavior, etc...just easier to deal with all around.

There are other facets as well, but making JavaScript manipulation tremendously simpler is a big one, for me atleast.


You can also use it as a workaround to the freezing animation issue. If, for example, you pop up a progress dialog with an animated gif in it when the user click a Submit button, the gif will freeze if you use the normal behaviour. If you set UseSubmitBehavior=False, then the gif will not freeze.

There are various other hacky ways of addresses the freezing gif issue but at least this one is simple.