The type or namespace name UpdatePanel does not exist in the namespace System.Web.UI

Kyle picture Kyle · Mar 7, 2012 · Viewed 21.6k times · Source

I'm working on a website built by another developer that targets ASP.NET 3.5. I'm trying to add an update panel around a bit of code, but whenever I attempt to do so I get the error posted in the title. I've tried including the ajaxcontroltoolkit dll with no luck.

The following are the referrences from the web config file:

<compilation debug="true">
      <assemblies>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Services.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>

And when I dragged the updatepanel onto the page from the toolbox in Visual Studio 2010, this is the register statement that was added:

<%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI" tagprefix="asp" %>

What am I missing?

Answer

Kyle picture Kyle · Mar 8, 2012

Turns out that this was a problem with Visual Studio not recognizing the System.Web.Extensions reference. To solve I followed these steps:

  1. Change target framework to a previous version (for me this was 2.0)
  2. Once that's done, change the target framework back to your original version (3.5 for me)

Visual Studio will make sure that your webconfig has all the proper trimmings and you can check for your success by opening the object explorer and making sure that System.Web.Extensions appears in the "View Containers" list.