ASP.NET AJAX weirdness

Posted by LoveMeSomeCode on Stack Overflow See other posts from Stack Overflow or by LoveMeSomeCode
Published on 2010-06-02T17:49:39Z Indexed on 2010/06/02 17:54 UTC
Read the original article Hit count: 269

Filed under:
|
|

Ok, I thought I understood these topics well, but I guess not, so hopefully someone here can clear this up.

Page.IsAsync seems to be broken. It always returns false.

But ScriptManager.IsInAsyncPostBack seems to work, sort of.

It returns true during the round trip for controls inside UpdatePanels. This is good; I can tell if it's a partial postback or a regular one.

ScriptManager.IsInAsyncPostBack returns false however for async Page Methods. Why is this? It's not a regular postback, I'm just calling a public static method on the page.

It causes a problem because I also realized that if you have a control with AutoPostBack = false, it won't trigger a postback on it's own, but if it has an event handler on the page, that event handler code WILL run on the next postback, regardless of how the postback occurred, IF the value has changed. i.e. if I tweak a dropdown and then hit a button, that dropdown's handler code will fire. This is ok, except that it will also happen during Page Method calls, and I have no way to know the difference.

Any thoughts?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about AJAX