Larsenal
Larsenal

Reputation: 51156

What can prevent a Postback in ASP.NET?

We have a user who is having problems with a ASP.NET app. The user hasn't been available to gather many details, but at this point our best guess is that the PostBack is not occurring. Something is going wrong between when the user clicks the LinkButton and when the HTTP Request is supposed to be made.

(User does have JS enabled)

Beyond solving the immediate problem, it might be helpful for posterity to assemble the canonical list of things that can break PostBack behavior of ASP.NET controls.

Upvotes: 1

Views: 1295

Answers (4)

Dan Diplo
Dan Diplo

Reputation: 25339

Having a self-closing <script /> tag can stop postbacks occurring. Get the user to send you any javascript errors from their log. There is actually a decent JS debugger in IE8 (about the only good thing in it!).

Upvotes: 1

D&#39;Arcy Rittich
D&#39;Arcy Rittich

Reputation: 171411

  • a form with no method attribute, or method note being set to POST
  • an onsubmit event handler that does not return true
  • trying to submit the form programatically, but unable to locate the form by id as there is another element with the same id on the page

Upvotes: 0

Spencer Ruport
Spencer Ruport

Reputation: 35117

I would first check that your <form> tags are well formed and that you don't have nested <form> tags. Both times I've debugged something to do with postback this turned out to be the problem. It's confusing because it's a browser dependent issue.

Upvotes: 2

Corey Sunwold
Corey Sunwold

Reputation: 10254

If you have say a button that has a postback event as well as a javascript event on click, if the javascript event that is fired returns false postback will be stopped.

Upvotes: 3

Related Questions