INTRODUCTION:
In this article I am
going to give you the solution to get rid of this error
"The type or
namespace name 'ToolkitScriptManager' does not exist in the namespace
'System.Web.UI.WebControls' (are you missing an assembly
reference?)".
This being a quite annoying error, many
usually come across while running a solution of a ASP.NET project which has got
few a AJAX coding in it
Now let me share
you the solution which had worked for me and hope the same for you too :)
SOLUTIONS:
POSSIBILITY 1:
- CHECK FOR AJAX CONTROL TOOLKIT :
This is the first thing you need to check for
,as the error clearly implies missing assembly reference.
If you have AJAX CONTROL TOOLKIT installed
then check for POSSIBILITY 2.
If you don't have it installed then install by
following the steps below.
STEPS
TO INSTALL AJAX CONTROL TOOLKIT:
- Go to project menu at the top and click 'manage NuGet Packages'
- A pop up opens and search for AJAX CONTROL TOOLKIT.
Install it and run the solution.
- If your error is disappeared then its well and good !! Else follow the steps as given in POSSIBILITY 2. !!
POSSIBILITY 2:
- STEP 1:
OOPS!! You may have a problem in registering
the ASSEMBLY of AJAX CONTROL TOOLKIT.
Here is the detailed explanation of what is
meant by 'registering the assembly'
As soon as you had installed the AJAX CONTROL
TOOLKIT check the following lines in web.config file
<configuration>
<system.web>
......
<pages controlRenderingCompatibilityVersion="3.5"
clientIDMode="AutoID"><controls>
<add
tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit"
namespace="AjaxControlToolkit" />
<add tagPrefix="asp"
namespace="System.Web.UI.WebControls"
assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
</system.web>
.........
<configuration>
You must find the
following lines under the tag 'pages' or search for it
Note:
The dotted lines
indicates the missing lines .I have shown only the necessary files for this
article because it will be bit confusing as to where the assembly tag for this
ajax resides.So have shown you the possible order of it !!
- STEP 2:
If you can find the above tags in your
web.config file then start your hunt in search of the keyword 'Register'
.
You may have a
particular .aspx page where you have used AJAX (coding in AJAX) .Say you have
used ajax in a page 'PaintBrush.aspx' then ,
Check for the highlighted line
of code below at the top of PaintBrush.aspx page.It is the line
that registers AJAX CONTROL TOOLKIT. If you have that
particular line its well and good ! But don't stop there. TagPrefix="asp" plays
a main role here.!!
<%@ Page
Language="C#" AutoEventWireup="true"
CodeBehind="PaintBrush.cs" Inherits="xxx.PaintBrush" %>
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit" TagPrefix="asp" %>
................. important line....................
<!DOCTYPE
html>
<html
xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Paint Brush</title>
<body>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1"
runat="server" EnablePageMethods="true">
</asp:ToolkitScriptManager>
</body>
</html>
The value of Tagprefix must
be same as that for ToolkitScriptManager.
ie.
If in your file,the
above mentioned tag is not same then change it .Save changes made and run the
solution.If the error persists,check the POSSIBILITY 3
POSSIBILITY 3:
Omg!! You may have issues in toolbox.Check the
following steps...
- STEP 1:
Under toolbox right click general and choose 'add
tab'
Give it a name
say 'ajax'
- STEP 2:
Right click newly created tab
'ajax' and click on 'choose items' .
A pop up opens as shown below
- STEP 3:
Click on 'browse'
and check for AjaxControlToolkit.dll . Click ok and
let it install!!
If you don't find it then you
must download it.
TO DOWNLOAD
AJAX CONTROL TOOLKIT.dll FOR VISUAL STUDIO :
Go to this link AjaxControlToolkit.dll and download it for the appropriate framework you are
using in VisualStudio.
Extract it and save it it
folder.Follow steps as in steps 2 and 3.
Save changes and run the
solution.
Clap your hands if you find
no more errors. :)
CONCLUSION:
These are the possible solutions to swipe out your
error. Its been one of the errors which I have come across. Hope this article
is helpful to you.Leave out your valuable comments and help me improvise !!Stay
updated with my upcoming articles too !! Happy coding :)
No comments :
Post a Comment