15

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?

Kyle
  • 680
  • 1
  • 7
  • 16

3 Answers3

34

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.

Kyle
  • 680
  • 1
  • 7
  • 16
  • Unbelievable that this solution actually works! i had the exact same problem and changed the framework version of my project from 4 back to 2 and then again back to 4 and away were the compile errors! – real_yggdrasil Dec 03 '14 at 20:34
  • 1
    I noticed the reference to System.Web.Extensions was removed when I switched from Framework 4.0 to Framework 4.5.1. Readded the reference and the problem went away. – rsbarro Mar 07 '16 at 23:02
  • I went from 4.6.1 => 4 => 4.6.1. Fixed! Thanks @Kyle – joehanna Jul 07 '20 at 01:40
20

Please add References: System.Web.Extensions

binhtruong.it
  • 229
  • 2
  • 4
  • This was the simplest solution. My project was running fine on .net 4.7.2 when I moved it to another machine and use .net 4.8. This problem occurred. Adding reference to System.Web.Extensions solved the problem – Shomaail Dec 06 '22 at 06:28
  • This worked for me using Visual Studio 2022, .NET 4.8 - thanks! – Lazlow Jan 25 '23 at 10:06
  • It definitely worked! I googled this exact same problem again today, came across this question and your answer - and realised I'd already thanked you. Thanks again, from forgetful me. – Lazlow Feb 03 '23 at 15:45
5

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

GodsCrimeScene
  • 1,260
  • 2
  • 17
  • 35
  • Suitable if you have copied the design code and pasted on the new project. Just add a dummy update panel and remove it. – Muhammedh Dec 15 '15 at 08:20