Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 745
Kyle Avatar asked Mar 07 '12 22:03

Kyle


3 Answers

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.

like image 162
Kyle Avatar answered Oct 05 '22 23:10

Kyle


Please add References: System.Web.Extensions

like image 34
binhtruong.it Avatar answered Oct 05 '22 22:10

binhtruong.it


Fixing this can also be accomplished by adding an update panel from the toolbox. Build, then delete control.

like image 23
GodsCrimeScene Avatar answered Oct 05 '22 22:10

GodsCrimeScene