When I view source on my ASP.NET page I get the following snippet:
The answer is a lot simpler than any I've seen here: just remove the PostBackUrl
from the Button
and all JavaScript disappears like magic.
Without JavaScript, an HTML button cannot submit to another page than the page specified in . However, ASP.NET does provide a possibility to do this out-of-the-box if you specify a
PostBackUrl
on a Button
. That's what the JavaScript is about: supporting a non-default post-back.
In this specific case your PostBackUrl
is the same as the 's
action
, but apparently ASP.NET does not special-case this and any non-empty string triggers this wrapper script.