Monday, February 26, 2007 9:07 PM Jan Tielens

Using the AJAX Control Toolkit in SharePoint

To get started with the ASP.NET AJAX extensions in SharePoint 2007, check out my previous posts:

Once you fell in love with ASP.NET AJAX, you have to check out the ASP.NET AJAX Control Toolkit! The ASP.NET AJAX Control Toolkit provides a set of sample controls and extenders that makes it a snap to spice up your web site with rich functionality. Think about the Control Toolkit as a bunch of sexy controls which use the ASP.NET AJAX extensions, plus a framework to create a new even sexier control on your own. In this post I'll describe how you can make use of the Control Toolkit in your SharePoint 2007 sites, for example by using the SmartPart.

Actually SharePoint doesn't differ from any other ASP.NET web site to use the Control Toolit, there are only three things that you need to do:

  1. Make sure SharePoint has access to AjaxControlToolkit.dll
    You can do this in two ways: either you deploy the assembly to the Global Assembly Cache (GAC) or you put in the \BIN folder of the SharePoint site's folder.
  2. Add an assembly reference in the web.config (note: for the future versions of the Control Tookit, the version number can change!):
    <assemblies>
        ...
        <add assembly="AjaxControlToolkit, Version=1.0.10201.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
        ....
    </assemblies>
  3. Add the tagprefix for the Control Toolkit in the web.config:
    <controls>
        ...
        <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>
        ....
    </controls>

That's it! Now you can make use of the Control Toolkit coolness in your SharePoint 2007 sites! If you want to test if the Control Toolkit is working on your installation: I've upload a very small example to CodePlex.

 

 

Technorati tags: , , , , ,

Filed under:

Comments

# " + title + "

Tuesday, February 27, 2007 6:18 AM by " + title + "

# re: Using the AJAX Control Toolkit in SharePoint

Thursday, March 15, 2007 6:19 AM by Horatiu

I've tried to make it work,but it seems that it doesen't with the new version of AJAX Control Toolkit(1.0.10301).Perhaps because of the change of tagPrefix from "ajaxToolkit" to "cc1".But although i've made several changes,and tried in severel ways,i didn't manage to make it work...

So,could you give me some help?

Thanks!

# re: Using the AJAX Control Toolkit in SharePoint

Tuesday, March 20, 2007 11:17 AM by Leon Zandman

Thanks Jan! It works perfectly!

# re: Using the AJAX Control Toolkit in SharePoint

Wednesday, March 21, 2007 10:14 AM by Anton

I'm just interested, is it work with MS SPP 2003?

# re: Using the AJAX Control Toolkit in SharePoint

Thursday, April 12, 2007 1:02 PM by W. Jason Strutz

I've been trying to deploy AJAX code to Sharepoint for some time, and ran into a few problems.  Eventually, I gave up on the SmartPart because no matter what I did, I couldn't get an XML object data source to read correctly.  However, since I started my solution search here, I thought I'd post some work arounds for some of the common errors I've seen.

I was getting an error about registering scripts before prerender.  The solutions I found online were to make sure that the AJAX toolkit was up to date, and that anywhere onprerender was overridden, make sure you call base.onprerender().  This didn't solve my problem.  Getting rid of all the UpdateProgress controls did solve the problem.

There's a sporadically reported error that doesn't seem to have a documented solution:

This control does not allow connection strings with the following keywords: ‘Integrated Security’, ‘Trusted_Connection’.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.SharePoint.WebPartPages.DataSourceControlDisabledException: This control does not allow connection strings with the following keywords: ‘Integrated Security’, ‘Trusted_Connection’.

I was able to get rid of this by putting my VS 2005 built ASPX pages in a separate virtual directory (running as an application), and editing the web.config for my new application.  Add the following section to the <system.web><pages> section:

<tagMapping>

   <remove tagType="System.Web.UI.WebControls.SqlDataSource, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</tagMapping>

I'm not sure if this would work for the smartpart, but since I had to use a separate web application anyway, it works for me.  Essentially, it tells SharePoint to get out of the way when accessing data sources.

# re: Using the AJAX Control Toolkit in SharePoint

Thursday, May 03, 2007 1:25 PM by sam

when would the full version of ReturnOfSmartpart  1.1 come out. The AJAX functionality is just what I have been waiting for and am eagerly looking forward for the full version.

# re: Using the AJAX Control Toolkit in SharePoint

Wednesday, May 09, 2007 8:52 AM by M. Starr

       I noticed the normal AJAX Enabled site has a few more tags in the Web.config. There are sections in HTTPHandlers (which appear to be in conflict with that MOSS has),config sectionGroups,  and System.WebServer sections. Are all these needed as well in a MOSS Web.Config?

     I have gotten my web part working for 1 single AJAX postback, after that it no longer posts back at all, not on the web part and the whole MOSS form (outside the web part) does not post back. Any ideas on what would cause this?

# re: Using the AJAX Control Toolkit in SharePoint

Sunday, May 20, 2007 7:46 PM by nj

15

# re: Using the AJAX Control Toolkit in SharePoint

Wednesday, July 04, 2007 4:58 PM by Daniel Harker

hi,

is it possible to use the control toolkit from within SPS Designer?

Or does it have to be done in pure code?

Regards

# re: Using the AJAX Control Toolkit in SharePoint

Friday, July 06, 2007 5:12 PM by Daniel Harker

Ok I've done a collapsible panel extender, but when i click on the control which should collapse the panel, it animates as though it is going to collapse.... but when the animation is complete it doesn't.

Any ideas?

Regards

# re: Using the AJAX Control Toolkit in SharePoint

Sunday, July 08, 2007 4:14 PM by Daniel Harker

More problems!

I've tried to put a tab panel in a custom list form.

I'm using the code:

      <asp:ScriptManager ID="ScriptManager1" runat="server" />

       <div>

           <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">

               <cc1:TabPanel ID="TabPanel1" runat="server">

                   <ContentTemplate>

                       <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

                   </ContentTemplate>

                   <HeaderTemplate>

                   Tab1

                   </HeaderTemplate>

               </cc1:TabPanel>

               <cc1:TabPanel ID="TabPanel2" runat="server">

                   <ContentTemplate>

                       <asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>

                   </ContentTemplate>

                   <HeaderTemplate>Tab 2</HeaderTemplate>

               </cc1:TabPanel>

           </cc1:TabContainer>

But when I look in the preview in SP Designer I get:

Undefined Tag Prefix cc1.

But I've used CC1 to define the tag in web.config.

Can anyone help?

Regards

# re: Using the AJAX Control Toolkit in SharePoint

Wednesday, July 18, 2007 4:44 PM by pkarl

where can I get teh smart part code and doc? The gotdotnet site dosen't appear to work

# re: Using the AJAX Control Toolkit in SharePoint

Tuesday, August 14, 2007 5:42 AM by Ashish

Thanks Jan

Your article was very helpful and I appericate that you are sharing your knowlede with peers.

Ashi

# PageRequestManagerParserErrorException Error when implementing Ajax and using Update Panel with sharepoint

Thursday, September 13, 2007 3:26 AM by Patrick.O.Ige

PageRequestManagerParserErrorException Error when implementing Ajax and using Update Panel with sharepoint

# re: Using the AJAX Control Toolkit in SharePoint

Thursday, September 20, 2007 1:33 AM by SrinivasReddy

I followed the approach.when uploading the webpart in the sharepoint iam getting this error.

"Extender Controls may not be Registered before PreRender."

# re: Using the AJAX Control Toolkit in SharePoint

Wednesday, October 17, 2007 6:37 AM by Serval

With the last version of Ajax Control Toolkit,  assembly in web.config of Sharepoint:

<add assembly="AjaxControlToolkit, Version=1.0.10920.32880, Culture=neutral, PublicKeyToken=28F01B0E84B6D53E"/></assemblies>

# re: Using the AJAX Control Toolkit in SharePoint

Wednesday, October 31, 2007 8:50 AM by Ahmed Elborollosy

With me also controls working only for 1 single AJAX postback

# re: Using the AJAX Control Toolkit in SharePoint

Wednesday, November 07, 2007 4:15 PM by Jason

Also controls working only for 1 single AJAX postback.

# re: Using the AJAX Control Toolkit in SharePoint

Thursday, November 22, 2007 11:34 AM by Luis Castanheira

I made all the config and wen i use just the ajax extensions components its ok , but when i use the ajax toolkit  components gives, in the sharepoint, "unspected error...."

(i used the to ways to  access to AjaxControlToolkit.dll )

what i'm doing wrong?

# re: Using the AJAX Control Toolkit in SharePoint

Tuesday, December 04, 2007 5:14 AM by Luis Castanheira

Ok this works nice

# re: Using the AJAX Control Toolkit in SharePoint

Wednesday, January 09, 2008 8:51 AM by Michael Creamer

I'm attempting to use the HoverMenuExtender from the AjaxControlToolkit within a user control within the SmartPart in WSS 3.0.

I am no longer getting an error (after making sure everything is in the web.config file) but the extender does not work (i.e. the rollover effect does not work).

Is there anything else I need to do to allow the AjaxControlToolkit to work in WSS 3.0?

Thanks!

Michael

# Ajax with MOSS | ganshani.com

Thursday, June 19, 2008 1:33 PM by Ajax with MOSS | ganshani.com

Pingback from  Ajax with MOSS | ganshani.com