All of the changes required to get AJAX to function correctly in existing ASP.Net web pages (and projects) are made in the existing web.config file for that project. The details can be found here:
http://ajax.asp.net/docs/ConfiguringASPNETAJAX.aspx
with one major change. In the “Controls Element” section of the article, the recommended action is to place the following in the web.config:
[system.web]
[pages]
[controls]
[add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/]
[/controls]
[/pages]
[/system.web]
For some reason, Visual Studio does not like to add the AJAX controls to the TagPrefix library “asp”, and the controls will not show up or be useable. Rather, you need to choose a different tagPrefix:
[pages]
[controls]
[add tagPrefix="ajax" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/]
[/controls]
[/pages]
[/system.web]
Obviously the server must have AJAX installed on it, the install can be found here, with the toolkit being a optional download:
http://ajax.asp.net/downloads/default.aspx?tabid=47
If you follow the article correctly, your asp project should now be “AJAX Enabled”, but if you are working in a Web Application Project, there is another step that needs to be taken. WAPs add an extra tag to the web.config:
[system.web]
[xhtmlConformance mode="Legacy" /]
[/system.web]
[/configuration]
This needs to be removed for AJAX controls to work propertly. If not removed, tags will appear to function properly, but when you actually “run” the site, they will not function at all.
(Reference for this issue)
http://forums.asp.net/thread/1607522.aspx
(Good info on the background of the problem)
http://weblogs.asp.net/scottgu/archive/2006/12/10/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax.aspx
No comments:
Post a Comment