Problem using Ajax with Visual Studio 2010 - asp.net

I am hoping someone can help me. I am trying to add Ajax controls to my VS 2010 project for the first time. I have previously gotten it to work when I used VS2008. I keep getting this exception:
Error 56 The type 'System.Web.UI.ExtenderControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Here’s what I did. I downloaded the ajax 4 toolkit and added a reference to the project. I also added a reference to system.web extension to my project. When I do this these lines get added to my web.config
<assemblies>
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies></compilation>
I added these lines to my aspx file.
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
And
<cc1:CalendarExtender runat="server" Id="txtDateOfBirth_CalendarExtender" TargetControlID="txtDateOfBirth"></cc1:CalendarExtender>
Etc.
I also backed off and tried ajax 3.5, this didn’t help. I did notice that the ajax dll is 4.1 while the 'System.Web.Extensions is 4.0. I don’t know if this matters but I cannot find ajax 4.0 or 'System.Web.Extensions 4.1.
Thank once again in advance.

This is not a solution but a recommendation: stay away from the Ajax toolkit or you are asking for trouble; use jquery instead (seriously, I have been down this road).

Related

Getting AJAXToolkit Configured

I have searched for days trying to find answers about how to configure AJAX Toolkit to work on my ASP.NET VB.NET site. I am having issues both with my development machine and on my hosing site. I cannot find a good reference on the settings for the web.config file, and the reference in my webpage that will allow the controls to work. Here is as much information that I have and I suspect most of it is wrong. If anyone is actually using AJAXToolkit that comes with Visual Studio 2015 and could provide some guidance I would greatly appreciate it. Here is the information I have.
My Configuration.
* Microsoft Visual Studio 2015 (64bit)
* Hosting with GoDaddy who says they support AJAX but does not say if that is AJAX TOOLKIT.
* ASP.NET AJAX Control Toolkit Version 1.0
* .NET FRAMEWORK 4.1.41102.0
* Development in ASP.NET VB.NET code behind pages.
* AJAX toolkit has been installed on my development workstation version 17.1.0.0
web.config file has not been modified to reference AJAXToolkit as I have not found a good example for this version of AJAXtoolkit.
I have added the following lines to my web.config file in the following areas.
<assemblies>
<add assembly="AjaxControlToolkit, Version=17.1.0.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
</assemblies>
<controls>
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=17.1.0.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
</controls>
On my test page in the header section.
I am actually amazed at how confusing this is. It almost appears that Microsoft has abandoned or never actually adopted AJAX. One would think that simply dropping a component from the Tool Bar into your application should actually work. But I have discovered that is far from the truth.
I have ventured down many different paths to resolve a problem on my site and the AJAX Tools will resolve it if only I can get any one of them to work.
Your help again is greatly appreciated.
Mike
In all my pages I simply have this directive:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %> and have included AjaxControlToolkit in my project references

Can I use Asp.net control in a SharePoint2010 webpart

I am new to SharePoint development, I am using VS2010 and SharePoint2010.
I am wondering whether there is a restriction using a asp.net ListView in a SharePoint web part control. Because for some reason the intelliSense does not provide me ListView, just a GridView
Thanks
Web Parts in SharePoint are ASP.NET Web Parts. So you can freely use without any restrictions the ASP.NET Controls.
The Code Behind might use the SharePoint API but everything you can do is provided by ASP.NET.
Edit:
Are you missing an Reference for the ListView ? You need to add a reference to System.Web.Extensions in order to use the ListView
There is not such kind of restriction in SharePoint. You can use any kind of asp.net control in SharePoint.
For ListView intelliSense, you need to register system.web.extensions in your control or webpart before using ListView.
Please copy below code for register Library:
<%# Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>

How to add ajax control in the project

I am using asp.net using C#.I want to add Ajax Control to my Web Pages.I am using visual studio 2005.That had ajax basic control not extended control and bin folder contain ajax controltoolkit.dll.But when I am adding control to my page,it shows the unknown elements.I add references and select that file(dll).Still the assembly details is not coming in my aspx page.And still saying unknown element.I have another project also.In that I done same ,and it works also.
You'll need to edit your web.config
<add assembly="AjaxControlToolkit, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
Goes between
<assemblies></assemblies>
tag.
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
Goes between
<controls></controls>
tag.

I don't have ListView in toolbox, intellisense, and doens't work in code

I am using ASP.NET v3.5 and Visual Studio 2008. For some reason ListView doesn't appear in my toolbox, it doesn't show up in intellisense when coding, and if I try to include one anyways I can't access it from code behind (will give error saying it isn't declared). What am I missing here.... where is my listview!?
Update: I have v3.5 installed but for some reason the project is using 2.0... now on to figure out how to change that. In my project references several things say version 3.5.0.0 and several say 2.0.0.0 .... is there any way to update everything to version 3.5 ???
Try changing your project's TargetFramework to 2.0 and follow VS.NET's instructions to reload project. Then change the TargetFramework back to 3.5 and follow instructions.
It worked for me to get the asp:ListView back into intellisense.
Not sure what gets VS.NET in this state though.
Does your project reference System.Web.Extensions? You will need to do so to get at the new ListView control.
Make sure you have a FQ assembly reference to the 3.5 version of System.Web.Extensions, in the web.config section.
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Also make sure you have a FQ assembly reference in the <system.web><compilation><assemblies> web.config section too.

LoadControl on control with assembly reference

I'm trying to use System.Web.UI.TemplateControl.LoadControl to build a templated web part for a SharePoint application, and I'm having trouble with a control that references an external assembly.
I have a user control with the first few lines like this:
<%# Control Language="C#" ClassName="MyControl" %>
<%# Assembly Name="AjaxControlToolkit" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
The web part derives from a base webpart that implements the templating and some other utilities which is in an assembly called "MyWebParts" (for example), while the derived web part class is in "MyProject". MyProject has a reference to "MyWebParts" (obviously), and to "AjaxControlToolkit", but "MyWebParts" does not have a reference to "AjaxControlToolkit". At runtime, when the templated web part tries to load the user control (a .ascx file in the "controltemplates" SharePoint root folder), it calls the base methods it inherited across assemblies, and it throws an HttpParseException, indicating that it couldn't load a required assembly. The EventViewer confirms that the assembly in question is AjaxControlToolkit.
I tried adding the AjaxControlToolkit assembly to the web.config for sharepoint, and it's sitting in the GAC, but to no avail.
Anyone know how I can do this without having a reference to every assembly in existence in my "MyWebParts" assembly?
Add a reference to your assembly in the web.config assemblies section, this will force sharepoint to load that assembly into memory, like so:
<assemblies>
<add assembly="AjaxControlToolkit, Version=1.0.10920.16768, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
</assemblies>
P.S. this is for ajax 1.0, correct the assembly version if you are using the AJAX 3.5 version.

Resources