This is a frequently asked question? I also had this question few months back. Because I had my project developed in ASP.net web site which did not have any Ajax components. But as the time went my client wanted the web application to have Ajax features which would make it much faster in terms of performance.

So I was in a spot of bother how to do it. And as a matter of fact I have decided to publish this in my weblog so any one could learn from it. Actually there is couple of ways to build a Ajax enabled web site.

1. Create an Ajax enabled web site at the start of the project.

a. Open visual studio

b. Go to file menu and create a new web site.

Create project

 

 

 

 

c. Select form visual studio installed templates select Asp.net Ajax enabled web site. (If you don’t see this means that you don’t have Ajax in your machine. So you better install the Ajax extensions first.)

Ajax Project

d. Once this is done you have your first Ajax enabled web site.

e. You can see that the project already have a web configuration file unlike the normal Asp.net web site which asks to create the web configuration file at the run time. The configuration file has some coding already written in it.

 

 

2. Change the web configuration file to Ajax enabled web sites web configuration.

a. There is couple of ways to deal with the existing Asp.net project. First create a Ajax enabled web site and see what included in the web configuration file.

<configuration>

<configSections>…</configSections>

<system.web>…</system.web>

<microsoft.web>…</microsoft.web>

<system.webServer>…</system.webServer>

</configuration>

b. You can see the above tag appearing with its content.

c. In a normal Asp.net web site it doesn’t have a initial web configuration and ask to create a configuration at the first time when you run the project.

Web config

d. The configuration file has these tags.

<configuration>

<appSettings/>

<connectionStrings/>

<system.web>

<compilation debug=true/>

<authentication mode=Windows/>

</system.web>

</configuration>

 

e. As you can see only the tag <system.web>… </system.web> comman in both the configeation files.

f. You can copy the code within the above tag of the Ajax enabled web site and add it put it within the same tag put your Asp.net web site

Next copy the other three tags <configSections>…</configSections>,<microsoft.web>…</microsoft.web> and <system.webServer>…</system.webServer> from the Ajax enabed web site web configeration and put them within the

<configuration>…</configuration> tag of the web configeration file of the ASP.net web site

 

Believe me this will make your Asp .net web site in to a Ajax enabled web site.

Few tips of how to use Ajax:

· If you want to use Ajax components in a web page you should add the script Manager Component to your web site first.

· The most widely used simplest to use component is the update panel which is used to refresh a part of the web page without having the page to post back.

· You can trigger the even the events form a component outside the update panel to refresh the update panel.

Advertisements