The name 'ScriptManager' does not exist in the current context

Dean picture Dean · Jan 6, 2014 · Viewed 17.6k times · Source

I copied some code to solve a problem with running JavaScript after an AJAX postback in ASP.Net. Unfortunately the new code gave me the following error when doing a build:

The name 'ScriptManager' does not exist in the current context

Now I've used the ScriptManager before, so why would it be giving me problems now? Isn't it available on all ASP.Net pages? I have a script manager on my master page after all...

Answer

Dean picture Dean · Jan 6, 2014

I suppose there could be a number of things wrong that would generate this error message. But for me, all I had to do was add the following using to the top of my code-behind file:

using System.Web.UI;

I hope this helps someone out there, maybe it'll save you some time.