Ajax Control Toolkit with SharePoint 2010
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
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.
Wonderful goods from you, man. I've understand your stuff previous to and you are just extremely Wonderful. I really like what you have acquired here, really like what you are stating and the way in which you say it. You make it entertaining and you still care for to keep it smart. I can not wait to read much more from you. This is really a terrific website.
ReplyDeleteDynalon 490834 Nylon Lab Sample Spatula Scraper With 4.5 Inch Rigid Blade