Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScriptManager.GetCurrent ( Page ).IsInAsyncPostBack throws an error at runtime

it's a couple of hours that I'm stuck on what apparently seems a very silly problem and I cannot move forward.

Basically if I try to evaluate the following at any of the event handlers of an ASP.NET Web Form Page (ie at Page_Load):

ScriptManager.GetCurrent ( Page ).IsInAsyncPostBack

I always get the following error:

'System.Web.UI.IScriptManager' does not contain a definition for 'GetCurrent' and no extension method 'GetCurrent' accepting a first argument of type 'System.Web.UI.IScriptManager' could be found (are you missing a using directive or an assembly reference?)

However if I evaluate the same in any of the embedded UserControls' events I do get a boolean value returned.

Am I missing something very basic?

like image 687
Giuseppe Romagnuolo Avatar asked May 22 '26 18:05

Giuseppe Romagnuolo


1 Answers

Are you using an AjaxControlToolkit-ScriptManager? I had also sometimes problems to debug the IsInAsyncPostBack value.

Change

ScriptManager.GetCurrent(Page).IsInAsyncPostBack

To

AjaxControlToolkit.ToolkitScriptManager.GetCurrent(Page).IsInAsyncPostBack 
like image 190
Tim Schmelter Avatar answered May 25 '26 06:05

Tim Schmelter