Programming is Passion,Software Development is an Adventure- Willy David Jr

Programming is Passion,Software Development is an Adventure- Willy David Jr

Adding AJAX to ASP.NET 2.0 Websites

This was really my problem wayback I starting learning AJAX. I cannot figure it out on how to add AJAX capability if I already have an existing website. One solution I remember at that time is I created an AJAX enabled website and transfer all my work there. Quite a tedious task, but that's what I really did! Anyway, as a benefits for others so that they will learn from my lesson, you don't really need to transfer your work, all you need is a bit of referencing, and additional configuration to your web.config file. And that's it, you can now use your UpdatePanel independently per page.

Here how it goes:

1.) Add a reference of AjaxControlToolkit.dll on your website. After that, you will see that your BIN folder is updated.

2.) Next, add <controls> tag under your <system.web> node. Here is the code:

<controls>
       <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>

3.) That's it. But if you are getting an error and if you still experience a postback on your page. Just add this addition tag/node under your <system.web>


<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>

 

That's it, your website must be fully working and functional using the power of AJAX!

// Willy David Jr