For updatepanels to work on a normal ASP .Net web site; i.e. converting ASP .Net web site to ASP .Net AJAX enabled web site, make sure on the below things
web.config should be should have the following entries that tell asp.net how to use the ajax libraries (replace [ by < and ] by >)
[httpHandlers]
[remove verb="*" path="*.asmx"/]
[add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/]
[add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/]
[add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/]
[/httpHandlers]
[httpModules]
[add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/]
[/httpModules]
For most case the above entry in the we.config should make the web site as AJAX enabled web site. However when the web application is converted from 2003 to 2005, by default the conversion will include the xhtmlconformance element entry in the web.config and by default this will be set to Legacy. This is because .Net server controls until 2.0 framework by default doesn't emit XHTML compliant markup, hence to support backward compatibility xhtmlconformance will be set to Legacy. This setting has different rendering than .Net 2.0 rendering, which by default is XHTML compliant, and which makes updatepanels not to work in this mode. Set the xhtmlconformance to either Transitional OR Strict, will change the rendering mode and for updatepanels to work.
However, changing the conformance will cause the updatepanels to work, you might want to check all other pages in the web site, where DOM is referenced in the javascript, to see if it renders properly. Since because the rendering mode will change the client ids generated will also be different. So if this ID is used in the js, then you might want to change those as well.
No comments:
Post a Comment