I had to use Ajax control toolkit with sharepoint and I had download the latest version from codeplex. We usually download latest versions of software because we believe that with latest version we can get more features and more bug-free. I had used Ajax Control Toolkit with SharePoint 2007 and it was much easier to configure and use Ajax Control Toolkit. With that belief in mind I had started using Ajax Control Toolkit in SharePoint 2010 downloading latest version for .net framework 3.5. But I failed and after investigating I had found the following errors.
-
AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.
-
Sys.registerComponent is not a function
The problem here is that latest versions of Ajax Control Toolkit is more optimized or targeted with .net framework 4.0. Even the Ajax control toolkit for .net framework 3.5 doesn’t work with SharePoint 2010. If you try to use Ajax Control Toolkit for 3.5 with SharePoint 2010, you may get the exceptions shown above.
How to make Ajax Control Toolkit working with SharePoint 2010?
Here are the steps to make Ajax Control Toolkit working with SharePoint 2010.
- Download Correct (compatible) version of Ajax Control Toolkit.
Since current release of Ajax Control Toolkit doesn’t work with SharePoint 2010, you need to download previous release. Maybe Ajax Control Toolkit team will address this issue and we’ll be able to use current Toolkit version with SharePoint in future. Until the current release is made compatible, please download the SharePoint 2010 compatible Ajax Control Toolkit from here.
- Add AjaxControlToolkit.dll reference to your project
To use the Ajax Control Toolkit in your SharePoint project, add reference to the AjaxControlToolkit.dll in your project. To use the Ajax Control Toolkit in any web part control add the following lines to register the Ajax Control Toolkit namespace.
<%@ Register Assembly="AjaxControlToolkit, Version=3.0.30930.28736,
Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> -
Remember, here version 3.x version of Ajax Control Toolkit is used instead 3.5.
- Add Ajax Control Toolkit ScriptManager in master page.
Open the Master page in SharePoint Designer. By default the v4.Master file is the default master page can be found “_catalogs/masterpage” folder. Before modifying the master page, keep a backup copy.
- First register the Ajax Control Toolkit namespace in the masterpage file by putting the following line at the top of the file:
<%@ Register Assembly="AjaxControlToolkit, Version=3.0.30930.28736,
Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> - Then remove the ScriptManager registration from the master page by removing the following line:
<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false"
EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true"/> - Finally Add the following line in place of the above line to register Ajax Control Toolkit
<ajaxToolkit:ToolkitScriptManager id="ScriptManager" runat="server" EnablePageMethods="false"
EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true"/>
- First register the Ajax Control Toolkit namespace in the masterpage file by putting the following line at the top of the file:
- Register Ajax Control Toolkit namespaces in SharePoint package Designer
Finally, you need to register the Ajax Control Toolkit namespace with SharePoint Package designer. Registering Ajax Control Toolkit namespaces will add Ajax Control Toolkit namespaces in web.config’s safecontrol list. First open the Package designer in Visual Studio (Package usually exists under Package folder in Visual Studio). And then click the “Advanced” button in package designer window as shown in the image below. In that advanced tab you can add/edit assemblies to be registered safe as part of the deployment of the solution package. Click Add ==> “Add Existing Assembly”. The following image shows wizard to follow.
Figure 1: Package Designer’s Advance tab
In the “Add existing Assembly” window, add the following namespaces for Ajax Control Toolkit.
Namespace Type Name Assembly Name AjaxControlToolkit * AjaxControlToolkit AjaxControlToolkit.Design * AjaxControlToolkit AjaxControlToolkit.HTMLEditor * AjaxControlToolkit AjaxControlToolkit.HTMLEditor.Popups * AjaxControlToolkit AjaxControlToolkit.HTMLEditor.ToolbarButton * AjaxControlToolkit AjaxControlToolkit.MaskedEditValidatorCompatibility * AjaxControlToolkit The following image shows the “Add Existing Assembly” window for AjaxControlToolkit dll.
Figure 2: Add/Edit Existing Assembly window
Now you can build and deploy the package and as a result of deployment, Ajax Control Toolkit namespaces will be registered as safe controls in web.config.
Conclusion
Its really hard to believe that Ajax Control Toolkit’s latest version doesn’t work with SharePoint. We expect to have the latest version of Ajax Control Toolkit to be compatible with SharePoint 2010. Until then we might have to use an old version of Ajax Control Toolkit.
Thanks for this great information. I was searching for this information 2-3 months back and gave on using Ajax control toolkit with SP2010.
ReplyDeleteAfter reading this I am thinking of utilizing Ajax contol toolkit but I have a question before that:
--> Replacement of registration with in master page will it break the normal SP2010 Out-of-the-box Ajax functionalties or the ajax functionalties I implemented in my custom webpart(basic ajax functions like async update etc.).
Registering the ajaxcontroltoolkit scriptmanager in master page will not break other pages as this scriptmanager is inherited from the asp.net ajax's scriptmanager.
ReplyDeleteVery nice topic...
ReplyDeleteUsefull for all
This comment has been removed by the author.
ReplyDeleteThis Blog is Ow-some.It really works thanks Sohel.
ReplyDeleteSome good sharepoint topics are also available at http://krutingandhi.blogspot.com
What file are you refering to put those lines in on step 2? Web.Config?
ReplyDeleteas specified already, I'm referring webpart user control (ascx).
ReplyDeletegreat post , many thanks
ReplyDeleteThank you for this topic!
ReplyDeleteI wrote webpart for SP2010.
ReplyDeleteAnd I'm can't use Ajax Toolkit because I don't have access to master page (I can't remove the ScriptManager registration from the master page by removing the line).
Hi,
ReplyDeleteDon't u have access to the sharepoint server? If you have access to the SharePoint server then u can open the site in sharepoint designer and modify the master page.
I too faced the same error while using Ajax with SP2010.I was struggling to resolve it at that time when searching in google i found your post and read it. What a great info you have given at the right time!! Thanks to Sohel to solve my error. Iam expecting more & more from you Sohel. Thanks a lot.
ReplyDeletehttp://godwinsblog.cdtech.in/2010/12/sharepoint-2010-root-of-certificate.html
During development webpart I certainly have access to the sharepoint server.
ReplyDeleteBut the webpart is distributed as an independent can be added by the user to any page.
I have very little experience with sharepoint, maybe I am not very well understand you. If you can tell me a more detailed solution to this problem, then I'll be very grateful.
Very useful info. Hope MS will make changes to new version of Ajax Toolkit.
ReplyDeletethank you for usefull information dude....u save my life...
ReplyDeleteI will be very thankful to u because of ur nice article
ReplyDeleteRegards
palani
Thanks all for your feedback. I'm glad that the post helps u.
ReplyDeleteHi Sohel, It is a gr8 post. I followed your instruction, but i am getting " is not permittied" in the masterpage.
ReplyDeleteYour help will be really appreciated.
Thank you
Jahangir
Is the new version (May 2011) compatible to SharePoint 2010?
ReplyDeleteSohel,
ReplyDeleteThanks for the wonderful Post - I had downloaded the latest version of the Ajax Toolkit and for the life of me I could not figure out why it worked for non-SharePoint projects, but nothing for SharePoint projects in VS 2010. You have saved me a great deal of time.
Thanks,
Coltrane
nice blog
ReplyDeletehi sohel can i get free telerik dll for my project
ReplyDeleteif yes plz give url
thanx in advance.........
Hi Mukesh, Sorry Telerik dll is not free as I know and you need to buy the license from Telerik to use it.
ReplyDeleteWow! It sure is a wonderful thing to learn that kind of application. It’s an added technique for a web developer to be able to make the best website.
ReplyDeleteThank you very much for this exceptional post! It helped me to solve the problem with 'SYS undefined' Java Script error message.
ReplyDeleteI am facing issue, I have post it in forum..please kindly reply.
ReplyDeletehttp://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/7af3c952-ec25-499f-8161-fcfb2b100bec
Thanks for good article, but... ;)
ReplyDeleteadd some note about session state(some controls will fail when is disabled)
BR
check out the following post on ajax toolkit installation in sharepoint
ReplyDeletehttp://www.dotnetstadium.com/2012/06/ajax-toolkit-configuration-for.html
step 5 is not understood, actually if i opened the package file in Visual Studio means, it will not open as you mentioned in screen shot.
ReplyDeleteIt will open as a code window.
how to open it as you said, pls help.
-karthick
Hi Sohel..
ReplyDeletevery useful post, I tried this in my development manchine.
what if i want to add scriptmanager to master page on production server?
Thanks
Shiva
@Charan, you need to prepare a custom master page and deploy it with module. Then in the custom master page, you can add the script manager. Another way is to use delegate control.
ReplyDeleteHi,
ReplyDeleteI am using asp.net ajax(2.0 version) in sharepoint 2007 and visual studio 2005.It is not working.
It shows error. i am followed this url( http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=806 )
can any one help me please.......
Thanks
Hi Sohel,
ReplyDeleteI want to use Ajax tabcontrol in Sharepoint 2013. How shoudl I go about it?
Thanks,
@Rekha, Instead of using Ajax Control Toolkit I would suggest to use jQuery Plugins which doesn't have server side dependency and less impact on deployment
ReplyDeleteHi SOHEL, Thank good info. But i have problem yet.
ReplyDeleteI want use Calendar Tool in SharePoint2013 webpart. So i made SharePoint Webpart, and wrote the ToolScriptmanager and CalendarEntender in ascx file. Project file has not error.
But if i try arrangement webpart in sharepointsite. I got error `Can`t found file or assably AjaxControlToolkit Version=4.5.7.1005 Culture~~`.
So I try this post, but I got error `Can`t found file or assably AjaxMin Version=4.5.7.1005 Culture~~`....changed error message AjaxControlToolkit -> AjaxMin.
How are you think?Am i must use javascript?
Ajax Control toolkit should not be your choice. Please use jQuery calender or other plugins, they are more supported and popular now than Ajax Control Toolkit
ReplyDeleteThanks SOHEL. I Try use JQuery
DeleteThis comment has been removed by the author.
ReplyDeletethanks for great post
ReplyDelete...but i have problem withe ajax script manager .when add it in the page it becomes too heavy ...if i replace it with default script manager the page load well but in this case ajax controls not work
Very Very Very Thanks
ReplyDeleteVery Very Very Thanks
Very Very Very Thanks
please Ajax Control Toolkit with SharePoint 2013