admin管理员组文章数量:1309146
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?
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?
Share Improve this question edited Oct 16, 2019 at 5:29 abatishchev 100k88 gold badges301 silver badges442 bronze badges asked Feb 24, 2011 at 18:02 Giuseppe RomagnuoloGiuseppe Romagnuolo 3,4022 gold badges31 silver badges38 bronze badges 1- What version of .Net is this? In 4.0 there's not even an IScriptManager interface, seems like this is a 2.0 thing. If you're not using .NET 2.0 is this possibly a library version conflict? Check your assembly references. – Jamie Treworgy Commented Feb 24, 2011 at 21:59
2 Answers
Reset to default 6Are 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
Check and make sure you didn't name your ScriptManager control "ScriptManager". If you did, the piler will try to use that control rather than calling the static GetCurrent method on the ScriptManager class.
本文标签: cScriptManagerGetCurrent ( Page )IsInAsyncPostBack throws an error at runtimeStack Overflow
版权声明:本文标题:c# - ScriptManager.GetCurrent ( Page ).IsInAsyncPostBack throws an error at runtime - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741792738a2397752.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论