Ajax Control Toolkit working with SharePoint 2010

How to make Ajax Control Toolkit working with SharePoint 2010?

Here are the steps to make Ajax Control Toolkit working with SharePoint 2010.
  1. 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.
  2. Add AjaxControlToolkit.dll reference to your projectTo 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" %>
    
  3. Remember, here version 3.x version of Ajax Control Toolkit is used instead 3.5.
  4. 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"/>
      
  5. 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.
    image
    Figure 1: Package Designer’s Advance tab

    In the “Add existing Assembly” window, add the following namespaces for Ajax Control Toolkit.
    NamespaceType NameAssembly 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.
    image
    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.

Comments

Popular posts from this blog

SharePoint: Group By on more than 2 columns in a view (SP 2010)

Configure Form Based Authentication (FBA) in SharePoint 2010

SharePoint 2010 Windows PowerShell Interview Questions