19

How can I tell if a method is running in the context of an AJAX postback (i.e as the result of a UpdatePanel (asynchronous) postback)?

According to egoldin Page.IsAsync is a very common confusion that has absolutely nothing to do with AJAX.

The correct approach is to use ScriptManager.GetCurrent ( Page ).IsInAsyncPostBack.

Shog9
  • 156,901
  • 35
  • 231
  • 235
rohancragg
  • 5,030
  • 5
  • 36
  • 47
  • 2
    Just had this problem, was using IsAsync instead of ScriptManager.GetCurrent ( Page ).IsInAsyncPostBack!!! – tpower Feb 13 '09 at 15:23

1 Answers1

24

Use ScriptManager.GetCurrent ( Page ).IsInAsyncPostBack

baretta
  • 7,385
  • 1
  • 25
  • 25